Passed
Pull Request — master (#18)
by Žilvinas
02:40
created

AbstractStatus::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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 View Code Duplication
abstract class AbstractStatus implements TokenizedQueryInterface
0 ignored issues
show
Duplication introduced by
This class 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...
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