Total Complexity | 6 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 |
||
76 | } |
||
77 | } |
||
78 |