| Total Complexity | 6 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | abstract class AbstractValidatedClass |
||
| 5 | { |
||
| 6 | abstract protected function getRequiredProperties(); |
||
| 7 | |||
| 8 | public function __construct($data = []) |
||
| 9 | { |
||
| 10 | foreach (get_object_vars($this) as $property => $default) { |
||
| 11 | if (array_key_exists($property, $data)) { |
||
| 12 | $this->{$property} = $data[$property]; |
||
| 13 | } |
||
| 14 | } |
||
| 15 | $this->validate(); |
||
| 16 | } |
||
| 17 | |||
| 18 | protected function validate() |
||
| 29 | } |
||
| 30 | } |
||
| 31 |