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