1
|
|
|
<?php declare (strict_types = 1); |
2
|
|
|
|
3
|
|
|
namespace Limoncello\Flute\Contracts\Validation; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015-2019 [email protected] |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Neomerx\JsonApi\Contracts\Http\Query\BaseQueryParserInterface; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @package Limoncello\Application |
25
|
|
|
*/ |
26
|
|
|
interface JsonApiQueryParserInterface extends BaseQueryParserInterface |
27
|
|
|
{ |
28
|
|
|
/** Query parameter */ |
29
|
|
|
const PARAM_IDENTITY = 'id'; |
30
|
|
|
|
31
|
|
|
/** Query parameter */ |
32
|
|
|
const PARAM_PAGING_LIMIT = 'limit'; |
33
|
|
|
|
34
|
|
|
/** Query parameter */ |
35
|
|
|
const PARAM_PAGING_OFFSET = 'offset'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param null|string $identity |
39
|
|
|
* @param array $parameters |
40
|
|
|
* |
41
|
|
|
* @return self |
|
|
|
|
42
|
|
|
*/ |
43
|
|
|
public function parse(?string $identity, array $parameters = []): self; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* If filters are joined with `AND` (or with `OR` otherwise). |
47
|
|
|
* |
48
|
|
|
* @return bool |
49
|
|
|
*/ |
50
|
|
|
public function areFiltersWithAnd(): bool; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return bool |
54
|
|
|
*/ |
55
|
|
|
public function hasFilters(): bool; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return bool |
59
|
|
|
*/ |
60
|
|
|
public function hasFields(): bool; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return bool |
64
|
|
|
*/ |
65
|
|
|
public function hasIncludes(): bool; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return bool |
69
|
|
|
*/ |
70
|
|
|
public function hasSorts(): bool; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return bool |
74
|
|
|
*/ |
75
|
|
|
public function hasPaging(): bool; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return mixed |
79
|
|
|
*/ |
80
|
|
|
public function getIdentity(); |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return iterable |
84
|
|
|
*/ |
85
|
|
|
public function getFilters(): iterable; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return int|null |
89
|
|
|
*/ |
90
|
|
|
public function getPagingOffset(): ?int; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return int|null |
94
|
|
|
*/ |
95
|
|
|
public function getPagingLimit(): ?int; |
96
|
|
|
} |
97
|
|
|
|
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.