Passed
Push — new-api ( 4bfe18...7ec1cc )
by Sebastian
05:06
created

Root::factory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
10
namespace Seboettg\CiteProc\Root;
11
12
use Seboettg\CiteProc\CiteProc;
13
use Seboettg\CiteProc\Style\InheritableNameAttributesTrait;
14
use Seboettg\CiteProc\Style\Options\NameOptions;
15
16
/**
17
 * Class Root
18
 * @package Seboettg\CiteProc\Style
19
 * @author Sebastian Böttger <[email protected]>
20
 */
21
class Root
22
{
23
    /** @var NameOptions */
24
    private $nameOptions;
25
26 173
    public static function factory($node)
27
    {
28 173
        $nameOptions = NameOptions::updateNameOptions($node);
29 173
        CiteProc::getContext()->setNameOptions($nameOptions);
30
31 173
        return new self($nameOptions);
32
    }
33
34 173
    public function __construct(NameOptions $nameOptions)
35
    {
36 173
        $this->nameOptions = $nameOptions;
37 173
    }
38
}
39