| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | 48 | public function __construct($object = null) |
|
| 11 | { |
||
| 12 | 48 | if ($object === null) { |
|
| 13 | 48 | return; |
|
| 14 | } |
||
| 15 | 16 | if (gettype($object) !== 'object') { |
|
| 16 | throw new RestException('Schema constructor expects object or null as parameter', [ |
||
| 17 | 'parameter' => $object, |
||
| 18 | ]); |
||
| 19 | } |
||
| 20 | 16 | foreach (get_object_vars($object) as $name => $value) { |
|
| 21 | 14 | $this->{$name} = $value; |
|
| 22 | } |
||
| 23 | 16 | } |
|
| 24 | |||
| 37 |