Delete   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 11
dl 0
loc 62
c 0
b 0
f 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A getValidationConstraints() 0 5 1
A __construct() 0 3 1
A getFields() 0 4 1
A createResult() 0 3 1
A getAction() 0 3 1
1
<?php
2
namespace Dokobit\Gateway\Query\File;
3
4
use Dokobit\Gateway\DocumentTypeProvider;
5
use Dokobit\Gateway\Query\QueryInterface;
6
use Dokobit\Gateway\Result\File\DeleteResult;
7
use Dokobit\Gateway\Result\ResultInterface;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * Check upload status.
12
 * @see https://gateway-sandbox.dokobit.com/api/doc#_api_file_delete
13
 */
14
class Delete implements QueryInterface
15
{
16
    /** @var string uploaded file token */
17
    private $token;
18
19
    /**
20
     * @param string $token uploaded file token
21
     */
22
    public function __construct(string $token)
23
    {
24
        $this->token = $token;
25
    }
26
27
    /**
28
     * Field and values association used in query
29
     * @return array
30
     */
31
    public function getFields(): array
32
    {
33
        return [
34
            'token' => $this->token,
35
        ];
36
    }
37
38
    /**
39
     * Validation constraints for request data validation
40
     * @return Assert\Collection
41
     */
42
    public function getValidationConstraints(): Assert\Collection
43
    {
44
        return new Assert\Collection([
45
            'token' => new Assert\Required([
46
                new Assert\NotBlank(),
47
            ]),
48
        ]);
49
    }
50
51
    /**
52
     * Result object for this query result
53
     * @return DeleteResult
54
     */
55
    public function createResult(): ResultInterface
56
    {
57
        return new DeleteResult();
58
    }
59
60
    /**
61
     * API action name, part of full API request url
62
     * @return string
63
     */
64
    public function getAction(): string
65
    {
66
        return "file/{$this->token}/delete";
67
    }
68
69
    /**
70
     * HTTP method to use
71
     * @return string
72
     */
73
    public function getMethod(): string
74
    {
75
        return QueryInterface::POST;
76
    }
77
}
78