Conditions | 5 |
Paths | 8 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5 |
Changes | 4 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
21 | 31 | public function __construct($data = array()) |
|
22 | { |
||
23 | 31 | if (is_object($data)) { |
|
24 | 1 | if ($data instanceof \ArrayObject) { |
|
25 | 1 | $data = $data->getArrayCopy(); |
|
26 | 1 | } elseif (method_exists($data, 'toArray')) { |
|
27 | 1 | $data = $data->toArray(); |
|
28 | 1 | } |
|
29 | 1 | } |
|
30 | 31 | if ( ! is_array($data)) { |
|
31 | 1 | throw new \InvalidArgumentException('Data passed to validator is not an array or an ArrayObject'); |
|
32 | } |
||
33 | 30 | $this->data = $data; |
|
34 | 30 | } |
|
35 | |||
47 |