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.
Completed
Push — master ( 7b42e1...c93f43 )
by Marius
10:41 queued 04:09
created

CookieRequestTrait   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 15.56 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 23.08%

Importance

Changes 0
Metric Value
dl 7
loc 45
ccs 3
cts 13
cp 0.2308
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A initCookie() 0 3 1
A hasCookieVar() 0 3 1
A getCookieVar() 7 7 2
A getCookieVars() 0 3 1
A setCookieVar() 0 3 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * @package presentation
4
 * @subpackage requests
5
 * @author marius orcsik <[email protected]>
6
 * @date 21.02.15
7
 */
8
namespace vsc\presentation\requests;
9
10
use vsc\Exception;
11
12
trait CookieRequestTrait {
13
	protected $aCookieVars = array();
14
15 17
	protected function initCookie($aCookies) {
16 17
		$this->aCookieVars = $aCookies;
17 17
	}
18
19
	/**
20
	 * @param string $sVarName
21
	 * @return bool
22
	 */
23
	public function hasCookieVar($sVarName) {
24
		return array_key_exists($sVarName, $this->aCookieVars);
25
	}
26
27
	/**
28
	 *
29
	 * @param string $sVarName
30
	 * @throws Exception
31
	 * @return mixed
32
	 */
33 View Code Duplication
	protected function getCookieVar($sVarName) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
		if (array_key_exists($sVarName, $this->aCookieVars)) {
35
			return HttpRequestA::getDecodedVar($this->aCookieVars[$sVarName]);
36
		} else {
37
			return null;
38
		}
39
	}
40
41
	/**
42
	 * @return array
43
	 */
44
	public function getCookieVars() {
45
		return $this->aCookieVars;
46
	}
47
48
	/**
49
	 * @param string $sVarName
50
	 * @param string $sVarValue
51
	 * @return bool
52
	 */
53
	public function setCookieVar($sVarName, $sVarValue) {
54
		return setcookie($sVarName, $sVarValue);
55
	}
56
}
57