| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | abstract class Resource implements JsonSerializable |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private $properties = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Resource constructor. |
||
| 17 | * |
||
| 18 | * @param array $properties |
||
| 19 | */ |
||
| 20 | public function __construct(array $properties = []) |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $name |
||
| 27 | * |
||
| 28 | * @return mixed |
||
| 29 | * @throws ResourcePropertyNotFoundException |
||
| 30 | */ |
||
| 31 | public function __get(string $name) |
||
| 32 | { |
||
| 33 | if (! isset($this->properties[$name])) { |
||
| 34 | throw new ResourcePropertyNotFoundException($name); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->properties[$name]; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @return array |
||
| 42 | */ |
||
| 43 | public function jsonSerialize() |
||
| 46 | } |
||
| 47 | } |
||
| 48 |