Passed
Push — master ( 279db1...661b73 )
by Sebastian
18:02 queued 11:37
created

GlobalOptions   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 68
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0
wmc 9

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDemoteNonDroppingParticles() 0 3 1
A __construct() 0 13 6
A isInitializeWithHyphen() 0 3 1
A getPageRangeFormat() 0 3 1
1
<?php
2
/*
1 ignored issue
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
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\Style\Options;
11
12
13
use SimpleXMLElement;
14
15
/**
16
 * Class GlobalOptionsTrait
17
 * @package Seboettg\CiteProc\Style
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
18
 * @author Sebastian Böttger <[email protected]>
1 ignored issue
show
Coding Style introduced by
Tag value for @author tag indented incorrectly; expected 2 spaces but found 1
Loading history...
19
 */
3 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
20
class GlobalOptions
21
{
22
23
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
24
     * @var bool
25
     */
26
    private $initializeWithHyphen = true;
0 ignored issues
show
Coding Style introduced by
Private member variable "initializeWithHyphen" must be prefixed with an underscore
Loading history...
27
28
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
29
     * @var PageRangeFormats
30
     */
31
    private $pageRangeFormat;
0 ignored issues
show
Coding Style introduced by
Private member variable "pageRangeFormat" must be prefixed with an underscore
Loading history...
32
33
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
34
     * @var DemoteNonDroppingParticle
35
     */
36
    private $demoteNonDroppingParticles;
0 ignored issues
show
Coding Style introduced by
Private member variable "demoteNonDroppingParticles" must be prefixed with an underscore
Loading history...
37
38
    /**
39
     * GlobalOptions constructor.
40
     * @param SimpleXMLElement $node
2 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
41
     */
42
    public function __construct(SimpleXMLElement $node)
43
    {
44
        /** @var SimpleXMLElement $attribute */
3 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
45
        foreach ($node->attributes() as $attribute) {
46
            switch ($attribute->getName()) {
47
                case 'initialize-with-hyphen':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
48
                    $this->initializeWithHyphen = "false" === (string) $attribute ? false : true;
49
                    break;
50
                case 'page-range-format':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
51
                    $this->pageRangeFormat = new PageRangeFormats((string) $attribute);
52
                    break;
53
                case 'demote-non-dropping-particle':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
54
                    $this->demoteNonDroppingParticles = new DemoteNonDroppingParticle((string) $attribute);
55
            }
56
        }
57
    }
58
59
    /**
60
     * Specifies whether compound given names (e.g. “Jean-Luc”) should be initialized with a hyphen (“J.-L.”, value
61
     * “true”, default) or without (“J.L.”, value “false”).
62
     * @return bool
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
63
     */
64
    public function isInitializeWithHyphen()
65
    {
66
        return $this->initializeWithHyphen;
67
    }
68
69
    /**
70
     * Activates expansion or collapsing of page ranges: “chicago” (“321–28”), “expanded” (e.g. “321–328”),
71
     * “minimal” (“321–8”), or “minimal-two” (“321–28”). Delimits page ranges
72
     * with the “page-range-delimiter” term (introduced with CSL 1.0.1, and defaults to an en-dash). If the attribute is
73
     * not set, page ranges are rendered without reformatting.
74
     * @return PageRangeFormats
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
75
     */
76
    public function getPageRangeFormat()
77
    {
78
        return $this->pageRangeFormat;
79
    }
80
81
    /**
82
     * Sets the display and sorting behavior of the non-dropping-particle in inverted names (e.g. “Koning, W. de”).
83
     * @return DemoteNonDroppingParticle
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
84
     */
85
    public function getDemoteNonDroppingParticles()
86
    {
87
        return $this->demoteNonDroppingParticles;
88
    }
89
90
}