1 | <?php |
||
17 | abstract class AbstractConnectionResolver extends WPGraphQLConnectionResolver |
||
18 | { |
||
19 | |||
20 | |||
21 | /** |
||
22 | * Determine whether the Query should execute. If it's determined that the query should |
||
23 | * not be run based on context such as, but not limited to, who the user is, where in the |
||
24 | * ResolveTree the Query is, the relation to the node the Query is connected to, etc |
||
25 | * Return false to prevent the query from executing. |
||
26 | * |
||
27 | * @return bool |
||
28 | */ |
||
29 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
||
30 | public function should_execute() |
||
34 | |||
35 | /** |
||
36 | * Set limit the highest value of first and last, with a (filterable) max of 100 |
||
37 | * |
||
38 | * @return array |
||
39 | */ |
||
40 | protected function getLimit() |
||
52 | |||
53 | /** |
||
54 | * Get_amount_requested |
||
55 | * |
||
56 | * This checks the $args to determine the amount requested |
||
57 | * |
||
58 | * @return int|null |
||
59 | * @throws \Exception |
||
60 | */ |
||
61 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
||
62 | public function get_amount_requested() |
||
76 | |||
77 | /** |
||
78 | * Determine whether or not the the offset is valid, i.e the entity corresponding to the |
||
79 | * offset exists. Offset is equivalent to entity ID. So this function is equivalent to |
||
80 | * checking if the entity with the given ID exists. |
||
81 | * |
||
82 | * @access public |
||
83 | * |
||
84 | * @param int $offset The ID of the node used for the cursor offset |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
||
89 | public function is_valid_offset($offset) |
||
95 | |||
96 | /** |
||
97 | * Validates Model. |
||
98 | * |
||
99 | * @param array $entity Entity node. |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
||
104 | protected function is_valid_model($entity) |
||
108 | |||
109 | |||
110 | /** |
||
111 | * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
||
112 | * friendly keys. |
||
113 | * |
||
114 | * @param array $query_args |
||
115 | * @param array $where_params |
||
116 | * @param string $primary_key |
||
117 | * @return array |
||
118 | */ |
||
119 | protected function mapOrderbyInputArgs(array $query_args, array $where_params, $primary_key) |
||
137 | |||
138 | |||
139 | /** |
||
140 | * This sets up the "allowed" args, and translates the GraphQL-friendly keys to model |
||
141 | * friendly keys. |
||
142 | * |
||
143 | * @param array $where_args |
||
144 | * @param array $arg_mapping |
||
145 | * @param array $id_fields The fields to convert from global IDs to DB IDs. |
||
146 | * @return array |
||
147 | */ |
||
148 | protected function sanitizeWhereArgsForInputFields( |
||
183 | |||
184 | |||
185 | /** |
||
186 | * Converts global ID to DB ID. |
||
187 | * |
||
188 | * @param string|string[] $ID |
||
189 | * @return mixed |
||
190 | */ |
||
191 | protected function convertGlobalId($ID) |
||
199 | } |
||
200 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: