| 1 | <?php |
||
| 5 | trait FluentArrayAccess |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Determine if the given offset exists. |
||
| 9 | * |
||
| 10 | * @param string $offset |
||
| 11 | * @return bool |
||
| 12 | */ |
||
| 13 | public function offsetExists($offset) |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Get the value for a given offset. |
||
| 20 | * |
||
| 21 | * @param string $offset |
||
| 22 | * @return mixed |
||
| 23 | */ |
||
| 24 | public function offsetGet($offset) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Set the value at the given offset. |
||
| 31 | * |
||
| 32 | * @param string $offset |
||
| 33 | * @param mixed $value |
||
| 34 | * @return void |
||
| 35 | */ |
||
| 36 | public function offsetSet($offset, $value) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Unset the value at the given offset. |
||
| 43 | * |
||
| 44 | * @param string $offset |
||
| 45 | * @return void |
||
| 46 | */ |
||
| 47 | public function offsetUnset($offset) |
||
| 51 | } |
||
| 52 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: