Open Journal Systems  3.3.0
StyleElement.php
1 <?php
2 /*
3  * citeproc-php
4  *
5  * @link http://github.com/seboettg/citeproc-php for the source repository
6  * @copyright Copyright (c) 2016 Sebastian Böttger.
7  * @license https://opensource.org/licenses/MIT
8  */
9 
10 namespace Seboettg\CiteProc\Style;
11 
17 use SimpleXMLElement;
18 
30 abstract class StyleElement
31 {
32 
37  protected $layout;
38 
42  protected $doNotSort;
43 
44  protected $parent;
45 
53  protected function __construct(SimpleXMLElement $node, $parent)
54  {
55  $this->parent = $parent;
56  // init child elements
58  foreach ($node->children() as $child) {
59  switch ($child->getName()) {
60  /* The cs:layout rendering element is a required child element of cs:citation and cs:bibliography. It
61  * must contain one or more of the other rendering elements described below, and may carry affixes and
62  * formatting attributes.
63  */
64  case 'layout':
65  $this->layout = new Layout($child, $this);
66  break;
67 
68  /* cs:citation and cs:bibliography may include a cs:sort child element before the cs:layout element to
69  * specify the sorting order of respectively cites within citations, and bibliographic entries within
70  * the bibliography. In the absence of cs:sort, cites and bibliographic entries appear in the order in
71  * which they are cited.
72  */
73  case 'sort':
74  $sorting = new Sort($child);
75  CiteProc::getContext()->setSorting($sorting);
76  }
77  }
78  }
79 
83  public function getParent()
84  {
85  return $this->parent;
86  }
87 }
Seboettg\CiteProc\Rendering\Layout
Definition: Layout.php:35
Seboettg\CiteProc\Style\InheritableNameAttributesTrait
trait InheritableNameAttributesTrait
Definition: InheritableNameAttributesTrait.php:37
Seboettg\CiteProc\Style\StyleElement\$layout
$layout
Definition: StyleElement.php:40
Seboettg\CiteProc\Exception\InvalidStylesheetException
Definition: InvalidStylesheetException.php:10
Seboettg\CiteProc\CiteProc
Definition: CiteProc.php:32
Seboettg\CiteProc\Style\StyleElement
Definition: StyleElement.php:30
Seboettg\CiteProc\Root\Root
Definition: Root.php:19
Seboettg\CiteProc\Style\StyleElement\$doNotSort
$doNotSort
Definition: StyleElement.php:48
Seboettg\CiteProc\Style\StyleElement\$parent
$parent
Definition: StyleElement.php:50
Seboettg\CiteProc\CiteProc\getContext
static getContext()
Definition: CiteProc.php:45
Seboettg\CiteProc\Style
Definition: Bibliography.php:10
Seboettg\CiteProc\Style\StyleElement\getParent
getParent()
Definition: StyleElement.php:89
Seboettg\CiteProc\Style\StyleElement\__construct
__construct(SimpleXMLElement $node, $parent)
Definition: StyleElement.php:59
Seboettg\CiteProc\Style\Sort\Sort
Definition: Sort.php:34