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