Completed
Pull Request — master (#1)
by Woody
23:31 queued 01:08
created

Token::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
namespace Equip\Auth;
3
4
class Token
5
{
6
    /**
7
     * @var string
8
     */
9
    private $token;
10
11
    /**
12
     * @var array
13
     */
14
    private $metadata;
15
16
    /**
17
     * @param string $token
18
     * @param array $metadata
19
     */
20 4
    public function __construct($token, array $metadata)
21
    {
22 4
         $this->token = $token;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
23 4
         $this->metadata = $metadata;
24 4
    }
25
26
    /**
27
     * @return string
28
     */
29 4
    public function getToken()
30
    {
31 4
        return $this->token;
32
    }
33
34
    /**
35
     * @param string|null $key
36
     * @return mixed
37
     */
38 4
    public function getMetadata($key = null)
39
    {
40 4
        if ($key !== null) {
41 1
             return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
42
        }
43 3
        return $this->metadata;
44
    }
45
}
46