| Conditions | 8 |
| Paths | 9 |
| Total Lines | 29 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | public function __construct(\SimpleXMLElement $node) |
||
| 43 | { |
||
| 44 | $this->authors = []; |
||
| 45 | $this->links = []; |
||
| 46 | |||
| 47 | /** @var \SimpleXMLElement $child */ |
||
| 48 | foreach ($node->children() as $child) { |
||
| 49 | switch ($child->getName()) { |
||
| 50 | case 'author': |
||
| 51 | case 'contributor': |
||
| 52 | $author = new \stdClass(); |
||
| 53 | /** @var \SimpleXMLElement $authorNode */ |
||
| 54 | foreach ($child->children() as $authorNode) { |
||
| 55 | $author->{$authorNode->getName()} = (string) $authorNode; |
||
| 56 | } |
||
| 57 | $this->authors[] = $author; |
||
| 58 | break; |
||
| 59 | case 'link': |
||
| 60 | foreach ($child->attributes() as $attribute) { |
||
| 61 | if ($attribute->getName() === "value") { |
||
| 62 | $this->links[] = (string) $attribute; |
||
| 63 | } |
||
| 64 | } |
||
| 65 | break; |
||
| 66 | default: |
||
| 67 | $this->{$child->getName()} = (string) $child; |
||
| 68 | } |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 103 | } |