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

Term::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php /** @noinspection PhpUnusedPrivateFieldInspection */
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
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
2
3
/**
4
 * citeproc-php
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
5
 *
6
 * @link        http://github.com/seboettg/citeproc-php for the source repository
1 ignored issue
show
Coding Style introduced by
Tag value for @link tag indented incorrectly; expected 6 spaces but found 8
Loading history...
7
 * @copyright   Copyright (c) 2016 Sebastian Böttger.
1 ignored issue
show
Coding Style introduced by
Tag value for @copyright tag indented incorrectly; expected 1 spaces but found 3
Loading history...
8
 * @license     https://opensource.org/licenses/MIT
1 ignored issue
show
Coding Style introduced by
Tag value for @license tag indented incorrectly; expected 3 spaces but found 5
Loading history...
9
 */
10
11
namespace Seboettg\CiteProc\Locale;
12
13
use InvalidArgumentException;
14
15
/**
16
 * Class Term
17
 * @package Seboettg\CiteProc\Locale
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
 *
19
 * @author Sebastian Böttger <[email protected]>
20
 */
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...
21
class Term
22
{
23
24
    private $name = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "name" must be prefixed with an underscore
Loading history...
25
26
    private $form = "long";
0 ignored issues
show
Coding Style introduced by
Private member variable "form" must be prefixed with an underscore
Loading history...
27
28
    private $single = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "single" must be prefixed with an underscore
Loading history...
29
30
    private $multiple = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "multiple" must be prefixed with an underscore
Loading history...
31
32
    private $match = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "match" must be prefixed with an underscore
Loading history...
33
34
    private $genderForm = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "genderForm" must be prefixed with an underscore
Loading history...
35
36
    private $gender = "";
0 ignored issues
show
Coding Style introduced by
Private member variable "gender" must be prefixed with an underscore
Loading history...
37
38
    public function __set($name, $value)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __set()
Loading history...
39
    {
40
        $nameParts = explode("-", $name);
41
        $attr = "";
42
        for ($i = count($nameParts) - 1; $i >= 0; --$i) {
43
            if ($i > 0) {
44
                $attr = ucfirst($nameParts[$i]) . $attr;
45
            } else {
46
                $attr = $nameParts[$i] . $attr;
47
            }
48
        }
49
        if (!isset($this->{$attr})) {
50
            throw new InvalidArgumentException("Property \"$attr\" ($name) does not exist in " . __CLASS__);
51
        }
52
        $this->{$attr} = $value;
53
    }
54
55
    public function __get($name)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __get()
Loading history...
56
    {
57
        return $this->{$name};
58
    }
59
60
    /**
1 ignored issue
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
61
     * @return string
62
     */
63
    public function getName()
64
    {
65
        return $this->name;
66
    }
67
68
}
69