Open Journal Systems  3.3.0
Info.php
1 <?php
2 /*
3  * citeproc-php
4  *
5  * @link http://github.com/seboettg/citeproc-php for the source repository
6  * @copyright Copyright (c) 2017 Sebastian Böttger.
7  * @license https://opensource.org/licenses/MIT
8  */
9 
11 
12 use SimpleXMLElement;
13 use stdClass;
14 
15 class Info
16 {
20  private $title;
21 
25  private $id;
26 
30  private $authors;
31 
35  private $links;
36 
37  public function __construct(SimpleXMLElement $node)
38  {
39  $this->authors = [];
40  $this->links = [];
41 
43  foreach ($node->children() as $child) {
44  switch ($child->getName()) {
45  case 'author':
46  case 'contributor':
47  $author = new stdClass();
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  }
64  }
65  }
66 
70  public function getTitle()
71  {
72  return $this->title;
73  }
74 
78  public function getId()
79  {
80  return $this->id;
81  }
82 
86  public function getAuthors()
87  {
88  return $this->authors;
89  }
90 
94  public function getLinks()
95  {
96  return $this->links;
97  }
98 }
Seboettg\CiteProc\Root\Info\getId
getId()
Definition: Info.php:90
Seboettg\CiteProc\Root\Info\__construct
__construct(SimpleXMLElement $node)
Definition: Info.php:49
Seboettg\CiteProc\Root\Info
Definition: Info.php:15
Seboettg\CiteProc\Root\Info\getTitle
getTitle()
Definition: Info.php:82
Seboettg\CiteProc\Root\Info\getLinks
getLinks()
Definition: Info.php:106
Seboettg\CiteProc\Root\Info\getAuthors
getAuthors()
Definition: Info.php:98
Seboettg\CiteProc\Root
Definition: Info.php:10