Passed
Push — master ( 661b73...ccb1dd )
by Sebastian
08:54 queued 05:17
created

DelimiterTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A initDelimiterAttributes() 0 11 3
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) 2016 Sebastian Böttger.
7
 * @license     https://opensource.org/licenses/MIT
8
 */
9
10
namespace Seboettg\CiteProc\Styles;
11
12
use SimpleXMLElement;
13
14
/**
15
 * Trait DelimiterTrait
16
 * @package Seboettg\CiteProc\Styles
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
17
 * @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...
18
 */
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...
19
trait DelimiterTrait
20
{
21
22
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
     * @param SimpleXMLElement $node
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
24
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
25 139
    protected function initDelimiterAttributes(SimpleXMLElement $node)
26
    {
27 139
        foreach ($node->attributes() as $attribute) {
28
            /** @var string $name */
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...
29 125
            $name = (string) $attribute->getName();
30 125
            $value = (string) $attribute;
31
32
            switch ($name) {
33 125
                case 'delimiter':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 12 spaces, found 16
Loading history...
34 91
                    $this->delimiter = $value;
0 ignored issues
show
Bug Best Practice introduced by
The property delimiter does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
35 91
                    return;
36
            }
37
        }
38
    }
39
}