Code Duplication    Length = 56-64 lines in 2 locations

src/Login/AbstractStatus.php 1 location

@@ 11-66 (lines=56) @@
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
    public function __construct($token)
20
    {
21
        $this->token = $token;
22
    }
23
24
    /**
25
     * Get token
26
     * @return string
27
     */
28
    public function getToken()
29
    {
30
        return $this->token;
31
    }
32
33
    /**
34
     * Get fields
35
     * @return array
36
     */
37
    public function getFields()
38
    {
39
        return [
40
            'token' => $this->token,
41
        ];
42
    }
43
44
    /**
45
     * Validation constraints for request data validation
46
     * @return Assert\Collection
47
     */
48
    public function getValidationConstraints()
49
    {
50
        return new Assert\Collection([
51
            'token' => new Assert\Required(
52
                [new Assert\NotBlank()]
53
            )
54
        ]);
55
    }
56
57
    /**
58
     * HTTP method to use
59
     * @return string
60
     */
61
    public function getMethod()
62
    {
63
        return QueryInterface::GET;
64
    }
65
}
66

src/Login/Sc.php 1 location

@@ 9-72 (lines=64) @@
6
use Isign\QueryInterface;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
class Sc implements QueryInterface
10
{
11
    /** @var string base64_encode(certificate) */
12
    private $certificate;
13
14
    /**
15
     * @param $certificate string base64_encode(certificate)
16
     */
17
    public function __construct($certificate)
18
    {
19
        $this->certificate = $certificate;
20
    }
21
22
    /**
23
     * API action name, part of full API request url
24
     * @return string
25
     */
26
    public function getAction()
27
    {
28
        return 'sc/login';
29
    }
30
31
    /**
32
     * Field and values association used in query
33
     * @return array
34
     */
35
    public function getFields()
36
    {
37
        return [
38
            'certificate'   => $this->certificate
39
        ];
40
    }
41
42
    /**
43
     * Result object for this query result
44
     * @return MobileResult
45
     */
46
    public function createResult()
47
    {
48
        return new ScResult();
49
    }
50
51
    /**
52
     * Validation constraints for fields
53
     * @return array
54
     */
55
    public function getValidationConstraints()
56
    {
57
        return new Assert\Collection([
58
            'certificate' => new Assert\Required([
59
                new Assert\NotBlank(),
60
            ])
61
        ]);
62
    }
63
64
    /**
65
     * HTTP method to use
66
     * @return string
67
     */
68
    public function getMethod()
69
    {
70
        return QueryInterface::POST;
71
    }
72
}
73