LoginAttempt::getData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
ccs 5
cts 5
cp 1
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Majora\Component\OAuth\Entity;
4
5
/**
6
 * Value object to represent a login attempt on an application.
7
 */
8
class LoginAttempt
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $query;
14
15
    /**
16
     * @var array
17
     */
18
    protected $data;
19
20
    /**
21
     * @var array
22
     */
23
    protected $headers;
24
25
    /**
26
     * Construct.
27
     *
28
     * @param array $query
29
     * @param array $data
30
     * @param array $headers
31
     */
32 14
    public function __construct(array $query, array $data, array $headers)
33
    {
34 14
        $this->query = $query;
35 14
        $this->data = $data;
36 14
        $this->headers = $headers;
37 14
    }
38
39
    /**
40
     * Returns query value under given key if defined, null otherwise.
41
     *
42
     * @param string $query
0 ignored issues
show
Bug introduced by
There is no parameter named $query. 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...
43
     *
44
     * @return mixed
45
     */
46
    public function getQuery($key)
47
    {
48
        return isset($this->query[$key]) ?
49
            $this->query[$key] :
50
            null
51
        ;
52
    }
53
54
    /**
55
     * Returns data value under given key if defined, null otherwise.
56
     *
57
     * @param string $data
0 ignored issues
show
Bug introduced by
There is no parameter named $data. 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...
58
     *
59
     * @return mixed
60
     */
61 14
    public function getData($key)
62
    {
63 14
        return isset($this->data[$key]) ?
64 14
            $this->data[$key] :
65 7
            null
66 7
        ;
67
    }
68
69
    /**
70
     * Returns headers value under given key if defined, null otherwise.
71
     *
72
     * @param string $headers
0 ignored issues
show
Bug introduced by
There is no parameter named $headers. 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...
73
     *
74
     * @return mixed
75
     */
76
    public function getHeaders($key)
77
    {
78
        return isset($this->headers[$key]) ?
79
            $this->headers[$key] :
80
            null
81
        ;
82
    }
83
}
84