Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 5.024 |
Changes | 0 |
1 | <?php |
||
45 | 5 | public function fill(Array $values) |
|
46 | { |
||
47 | 5 | foreach ($values as $label => $value) { |
|
48 | 5 | $child = $this->getChild($label); |
|
49 | |||
50 | 5 | if (is_null($child)) { |
|
51 | throw new Exception\ChildNotFoundException( |
||
52 | "The child '$label' does not exists inside the form element" |
||
53 | ); |
||
54 | } |
||
55 | |||
56 | 5 | if (!$child->isFormControl()) { |
|
57 | throw new Exception\NotFormControlException( |
||
58 | "The child '$label' is not a form control" |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | 5 | $child->setAttribute(new Attribute("value", $value)); |
|
63 | } |
||
66 |