Test Failed
Push — master ( 9d4e41...1cd52c )
by Sebastian
03:24
created

Citation::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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
use Seboettg\CiteProc\Rendering\Layout;
12
use Seboettg\CiteProc\Rendering\RenderingInterface;
13
use Seboettg\CiteProc\Util\Factory;
14
15
16
/**
17
 * Class Citation
18
 *
19
 * The cs:citation element describes the formatting of citations, which consist of one or more references (“cites”) to
20
 * bibliographic sources. Citations appear in the form of either in-text citations (in the author (e.g. “[Doe]”),
21
 * author-date (“[Doe 1999]”), label (“[doe99]”) or number (“[1]”) format) or notes. The required cs:layout child
22
 * element describes what, and how, bibliographic data should be included in the citations (see Layout).
23
 *
24
 * @package Seboettg\CiteProc\Node\Style
25
 *
26
 * @author Sebastian Böttger <[email protected]>
27
 */
28
class Citation extends StyleElement
29
{
30
31
    private $node;
32
33
    /**
34
     * Citation constructor.
35
     * @param \SimpleXMLElement $node
36
     */
37
    public function __construct(\SimpleXMLElement $node)
38
    {
39
        parent::__construct($node);
40
        $this->node = $node;
41
    }
42
43
    /**
44
     * @param array|DataList $data
45
     * @param int|null $citationNumber
46
     * @return string
47
     */
48
    public function render($data, $citationNumber = null)
49
    {
50
        $this->initInheritableNameAttributes($this->node);
51
        return $this->layout->render($data, $citationNumber);
52
    }
53
54
}