[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 namespace GuzzleHttp; 3 4 /** 5 * Trait implementing ToArrayInterface, \ArrayAccess, \Countable, 6 * \IteratorAggregate, and some path style methods. 7 */ 8 trait HasDataTrait 9 { 10 /** @var array */ 11 protected $data = []; 12 13 public function getIterator() 14 { 15 return new \ArrayIterator($this->data); 16 } 17 18 public function offsetGet($offset) 19 { 20 return isset($this->data[$offset]) ? $this->data[$offset] : null; 21 } 22 23 public function offsetSet($offset, $value) 24 { 25 $this->data[$offset] = $value; 26 } 27 28 public function offsetExists($offset) 29 { 30 return isset($this->data[$offset]); 31 } 32 33 public function offsetUnset($offset) 34 { 35 unset($this->data[$offset]); 36 } 37 38 public function toArray() 39 { 40 return $this->data; 41 } 42 43 public function count() 44 { 45 return count($this->data); 46 } 47 48 /** 49 * Get a value from the collection using a path syntax to retrieve nested 50 * data. 51 * 52 * @param string $path Path to traverse and retrieve a value from 53 * 54 * @return mixed|null 55 */ 56 public function getPath($path) 57 { 58 return Utils::getPath($this->data, $path); 59 } 60 61 /** 62 * Set a value into a nested array key. Keys will be created as needed to 63 * set the value. 64 * 65 * @param string $path Path to set 66 * @param mixed $value Value to set at the key 67 * 68 * @throws \RuntimeException when trying to setPath using a nested path 69 * that travels through a scalar value 70 */ 71 public function setPath($path, $value) 72 { 73 Utils::setPath($this->data, $path, $value); 74 } 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |