Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | 9 | public function attr($name, $value = null) |
|
20 | { |
||
21 | 9 | if (!($this->node instanceof \DOMElement)) { |
|
22 | 3 | throw new \Exception('dom node is not of type element'); |
|
23 | } |
||
24 | |||
25 | 6 | if ($value) { |
|
26 | 3 | $this->node->setAttribute($name, $value); |
|
27 | 3 | } |
|
28 | |||
29 | 6 | return $this->node->getAttribute($name); |
|
30 | } |
||
31 | |||
49 |