Passed
Push — master ( 66db8b...8cd4fd )
by Žilvinas
41s
created

AbstractStatus   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 55
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getToken() 0 4 1
A getFields() 0 6 1
A getValidationConstraints() 0 8 1
A getMethod() 0 4 1
1
<?php
2
namespace Isign\Login;
3
4
use Isign\QueryInterface;
5
use Isign\TokenizedQueryInterface;
6
use Symfony\Component\Validator\Constraints as Assert;
7
8
/**
9
 * Login status for MobileId, SmartId, etc.
10
 */
11
abstract class AbstractStatus implements TokenizedQueryInterface
12
{
13
    /** @var string unique resource identifier, received from mobile login request */
14
    protected $token;
15
16
    /**
17
     * @param string $token unique resource identifier, received from mobile login request
18
     */
19 28
    public function __construct($token)
20
    {
21 28
        $this->token = $token;
22 28
    }
23
24
    /**
25
     * Get token
26
     * @return string
27
     */
28 4
    public function getToken()
29
    {
30 4
        return $this->token;
31
    }
32
33
    /**
34
     * Get fields
35
     * @return array
36
     */
37 4
    public function getFields()
38
    {
39
        return [
40 4
            'token' => $this->token,
41
        ];
42
    }
43
44
    /**
45
     * Validation constraints for request data validation
46
     * @return Assert\Collection
47
     */
48 4
    public function getValidationConstraints()
49
    {
50 4
        return new Assert\Collection([
51 4
            'token' => new Assert\Required(
52 4
                [new Assert\NotBlank()]
53
            )
54
        ]);
55
    }
56
57
    /**
58
     * HTTP method to use
59
     * @return string
60
     */
61 4
    public function getMethod()
62
    {
63 4
        return QueryInterface::GET;
64
    }
65
}
66