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

Token   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 42
wmc 5
lcom 1
cbo 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getToken() 0 4 1
A getMetadata() 0 7 3
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