| 1 | <?php |
||
| 9 | abstract class APIResponse |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Construct object optionally with a set of properties. |
||
| 13 | * |
||
| 14 | * @param array $properties |
||
| 15 | */ |
||
| 16 | // public function __construct(array $properties = []) |
||
| 17 | // { |
||
| 18 | // foreach ($properties as $property => $value) { |
||
| 19 | // $this->{$property} = $value; |
||
| 20 | // } |
||
| 21 | // } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Magic set function handling writes to non public properties. |
||
| 25 | * |
||
| 26 | * |
||
| 27 | * @param string $property Name of the property |
||
| 28 | * @param string $value |
||
| 29 | * |
||
| 30 | * @throws PropertyNotFoundException |
||
| 31 | */ |
||
| 32 | // public function __set($property, $value) |
||
| 33 | // { |
||
| 34 | // if (!property_exists($this, $property)) { |
||
| 35 | // throw new PropertyNotFoundException($property, get_class($this)); |
||
| 36 | // } |
||
| 37 | // |
||
| 38 | // $this->{$property} = $value; |
||
| 39 | // } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Magic get function handling read to non public properties. |
||
| 43 | * |
||
| 44 | * Returns value for all readonly (protected) properties. |
||
| 45 | * |
||
| 46 | * |
||
| 47 | * @param string $property Name of the property |
||
| 48 | * |
||
| 49 | * @throws PropertyNotFoundException |
||
| 50 | * |
||
| 51 | * @return mixed |
||
| 52 | */ |
||
| 53 | // public function __get($property) |
||
| 54 | // { |
||
| 55 | // if (property_exists($this, $property)) { |
||
| 56 | // return $this->{$property}; |
||
| 57 | // } |
||
| 58 | // |
||
| 59 | // throw new PropertyNotFoundException($property, get_class($this)); |
||
| 60 | // } |
||
| 61 | } |
||
| 62 |