| Conditions | 8 |
| Paths | 9 |
| Total Lines | 26 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 8.0109 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 162 | public function __construct(SimpleXMLElement $node) |
|
| 38 | { |
||
| 39 | 162 | $this->authors = []; |
|
| 40 | 162 | $this->links = []; |
|
| 41 | |||
| 42 | /** @var SimpleXMLElement $child */ |
||
| 43 | 162 | foreach ($node->children() as $child) { |
|
| 44 | 160 | switch ($child->getName()) { |
|
| 45 | 160 | case 'author': |
|
| 46 | 160 | case 'contributor': |
|
| 47 | 42 | $author = new stdClass(); |
|
| 48 | /** @var SimpleXMLElement $authorNode */ |
||
| 49 | 42 | foreach ($child->children() as $authorNode) { |
|
| 50 | 42 | $author->{$authorNode->getName()} = (string) $authorNode; |
|
| 51 | } |
||
| 52 | 42 | $this->authors[] = $author; |
|
| 53 | 42 | break; |
|
| 54 | 160 | case 'link': |
|
| 55 | 42 | foreach ($child->attributes() as $attribute) { |
|
| 56 | 42 | if ($attribute->getName() === "value") { |
|
| 57 | $this->links[] = (string) $attribute; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | 42 | break; |
|
| 61 | default: |
||
| 62 | 160 | $this->{$child->getName()} = (string) $child; |
|
| 63 | } |
||
| 99 |