| 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 |
||
| 28 | 15 | public function attr($name, $value = null) |
|
| 29 | { |
||
| 30 | 15 | if (!($this->node instanceof \DOMElement)) { |
|
| 31 | 3 | throw new \Exception('dom node is not of type element'); |
|
| 32 | } |
||
| 33 | |||
| 34 | 12 | if ($value !== null) { |
|
| 35 | 6 | $this->node->setAttribute($name, $value); |
|
| 36 | 6 | } |
|
| 37 | |||
| 38 | 12 | return $this->node->getAttribute($name); |
|
| 39 | } |
||
| 40 | |||
| 69 |