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