| 1 | <?php |
||
| 7 | trait ProtectedValueObject |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Checks if a property is defined in the object |
||
| 11 | * |
||
| 12 | * This will return `false` if the value is `null`! To check if a value |
||
| 13 | * exists in the object, use `has()`. |
||
| 14 | * |
||
| 15 | * @param string $key |
||
| 16 | * |
||
| 17 | * @return boolean |
||
| 18 | */ |
||
| 19 | public function __isset($key) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Allow read access to immutable object properties |
||
| 26 | * |
||
| 27 | * @param string $key |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function __get($key) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Protects against the object being modified |
||
| 38 | * |
||
| 39 | * @param string $key |
||
| 40 | * @param mixed $value |
||
| 41 | * |
||
| 42 | * @return void |
||
| 43 | * |
||
| 44 | * @throws \RuntimeException |
||
| 45 | */ |
||
| 46 | public function __set($key, $value) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Protects against the object being modified |
||
| 56 | * |
||
| 57 | * @param string $key |
||
| 58 | * |
||
| 59 | * @return void |
||
| 60 | * |
||
| 61 | * @throws \RuntimeException |
||
| 62 | */ |
||
| 63 | public function __unset($key) |
||
| 70 | } |
||
| 71 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.