Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
54 | 8 | public function addField($field) |
|
55 | { |
||
56 | 8 | if ($field instanceof static::$fieldClass) { |
|
|
|||
57 | 2 | $this->fields[] = $field; |
|
58 | |||
59 | 2 | return $this; |
|
60 | 6 | } elseif (is_array($field)) { |
|
61 | 5 | $this->fields[] = new static::$fieldClass($field); |
|
62 | |||
63 | 5 | return $this; |
|
64 | } |
||
65 | |||
66 | 1 | throw new InvalidArgumentException('The field must be an instance of '.static::$fieldClass.' or a keyed array'); |
|
67 | } |
||
98 |