GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

User::getCountry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PhpAbac\Example;
4
5
class User {
6
    /** @var int **/
7
    private $id;
8
    /** @var string **/
9
    private $name;
10
    /** @var int **/
11
    private $age;
12
    /** @var string **/
13
    private $parentNationality;
14
    /** @var array **/
15
    private $visas;
16
    /** @var bool **/
17
    private $hasDoneJapd;
18
    /** @var bool **/
19
    private $hasDrivingLicense;
20
    /** @var string Iso code of user country */
21
    private $country;
22
23
    /**
24
     * @param int $id
25
     * @return \PhpAbac\Example\User
26
     */
27 8
    public function setId($id) {
28 8
        $this->id = $id;
29
        
30 8
        return $this;
31
    }
32
    
33
    /**
34
     * @return int
35
     */
36 2
    public function getId() {
37 2
        return $this->id;
38
    }
39
    
40
    /**
41
     * @param string $name
42
     * @return \PhpAbac\Example\User
43
     */
44 6
    public function setName($name) {
45 6
        $this->name = $name;
46
        
47 6
        return $this;
48
    }
49
    
50
    /**
51
     * @return string
52
     */
53
    public function getName() {
54
        return $this->name;
55
    }
56
    
57
    /**
58
     * @param int $age
59
     * @return \PhpAbac\Example\User
60
     */
61 8
    public function setAge($age) {
62 8
        $this->age = $age;
63
        
64 8
        return $this;
65
    }
66
    
67
    /**
68
     * @return int
69
     */
70 5
    public function getAge() {
71 5
        return $this->age;
72
    }
73
    
74
    /**
75
     * @param string $parentNationality
76
     * @return \PhpAbac\Example\User
77
     */
78 7
    public function setParentNationality($parentNationality) {
79 7
        $this->parentNationality = $parentNationality;
80
        
81 7
        return $this;
82
    }
83
    
84
    /**
85
     * @return bool
86
     */
87 2
    public function getParentNationality() {
88 2
        return $this->parentNationality;
89
    }
90
    
91
    /**
92
     * @param \PhpAbac\Example\Visa $visa
93
     * @return \PhpAbac\Example\User
94
     */
95 6
    public function addVisa(Visa $visa) {
96 6
        $this->visas[$visa->getId()] = $visa;
97
        
98 6
        return $this;
99
    }
100
    
101
    /**
102
     * @param \PhpAbac\Example\Visa $visa
103
     * @return \PhpAbac\Example\User
104
     */
105
    public function removeVisa(Visa $visa) {
106
        if(isset($this->visas[$visa->getId()])) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after IF keyword; 0 found
Loading history...
107
            unset($this->visas[$visa->getId()]);
108
        }
109
        return $this;
110
    }
111
    
112
    /**
113
     * @return array
114
     */
115 1
    public function getVisas() {
116 1
        return $this->visas;
117
    }
118
	
119
	/**
120
	 * Return a specific visa
121
	 *
122
	 * @param Visa $visa
0 ignored issues
show
Bug introduced by
There is no parameter named $visa. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
123
	 *
124
	 * @return mixed|null
125
	 */
126 2
    public function getVisa($country_code) {
127
    	/** @var Visa $visa */
128 2
    	$visas = [];
129 2
		foreach($this->visas as $visa) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FOREACH keyword; 0 found
Loading history...
130 2
    		if ($visa->getCountry()->getCode() == $country_code)
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
131 2
				$visas[] = $visa;
132 2
		}
133 2
		return $visas;
134
	}
135
    
136
    /**
137
     * @param bool $hasDoneJapd
138
     * @return \PhpAbac\Example\User
139
     */
140 6
    public function setHasDoneJapd($hasDoneJapd) {
141 6
        $this->hasDoneJapd = $hasDoneJapd;
142
        
143 6
        return $this;
144
    }
145
    
146
    /**
147
     * @return bool
148
     */
149 1
    public function getHasDoneJapd() {
150 1
        return $this->hasDoneJapd;
151
    }
152
    
153
    /**
154
     * @param bool $hasDrivingLicense
155
     * @return \PhpAbac\Example\User
156
     */
157 6
    public function setHasDrivingLicense($hasDrivingLicense) {
158 6
        $this->hasDrivingLicense = $hasDrivingLicense;
159
        
160 6
        return $this;
161
    }
162
    
163
    /**
164
     * @return bool
165
     */
166 1
    public function getHasDrivingLicense() {
167 1
        return $this->hasDrivingLicense;
168
    }
169
170
171
    /**
172
     * Function to set the iso code of the user country
173
     *
174
     * @param $country
175
     */
176 5
    public function setCountry($country) {
177 5
        $this->country = $country;
178
179 5
        return $this;
180
    }
181
182
    /**
183
     * @return string Iso code of the user country
184
     */
185 1
    public function getCountry() {
186 1
        return $this->country;
187
    }
188
}