This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace As3\Modlr\Api; |
||
4 | |||
5 | use As3\Modlr\Metadata\EntityMetadata; |
||
6 | use As3\Modlr\Models\Collections\Collection; |
||
7 | use As3\Modlr\Models\Model; |
||
8 | use As3\Modlr\Rest; |
||
9 | use As3\Modlr\Store\Store; |
||
10 | |||
11 | /** |
||
12 | * Interface for handling API operations. |
||
13 | * |
||
14 | * @author Jacob Bare <[email protected]> |
||
15 | */ |
||
16 | interface AdapterInterface |
||
17 | { |
||
18 | /** |
||
19 | * Processes a REST request and formats them into REST responses. |
||
20 | * |
||
21 | * @param Rest\RestRequest $request |
||
22 | * @return Rest\RestResponse |
||
23 | */ |
||
24 | public function processRequest(Rest\RestRequest $request); |
||
25 | |||
26 | /** |
||
27 | * Finds a single model by id. |
||
28 | * |
||
29 | * @param string $typeKey |
||
30 | * @param string $identifier |
||
31 | * @param array $fields |
||
32 | * @param array $inclusions |
||
33 | * @return Rest\RestResponse |
||
34 | */ |
||
35 | public function findRecord($typeKey, $identifier, array $fields = [], array $inclusions = []); |
||
36 | |||
37 | /** |
||
38 | * Finds a model (or models) for a model's related field. |
||
39 | * |
||
40 | * @param string $typeKey |
||
41 | * @param string $identifier |
||
42 | * @param string $fieldKey |
||
43 | * @return Rest\RestResponse |
||
44 | * @throws AdapterException If the related field does not exist on the model. |
||
45 | */ |
||
46 | public function findRelationship($typeKey, $identifier, $fieldKey); |
||
47 | |||
48 | /** |
||
49 | * Finds a multiple models by type. |
||
50 | * |
||
51 | * @param string $typeKey |
||
52 | * @param array $identifiers |
||
53 | * @param array $fields |
||
54 | * @param array $sort |
||
55 | * @param array $pagination |
||
56 | * @param array $inclusions |
||
57 | * @return Rest\RestResponse |
||
58 | */ |
||
59 | public function findAll($typeKey, array $identifiers = [], array $fields = [], array $sort = [], array $pagination = [], array $inclusions = []); |
||
60 | |||
61 | /** |
||
62 | * Queries records based on a provided set of criteria. |
||
63 | * |
||
64 | * @param string $typeKey The model type. |
||
65 | * @param array $criteria The query criteria. |
||
66 | * @param array $fields Fields to include/exclude. |
||
67 | * @param array $sort The sort criteria. |
||
68 | * @param array $pagination The pagination criteria (offset and limit). |
||
69 | * @param array $inclusions The inclusion criteria for side-loading related models. |
||
70 | * @return Rest\RestResponse |
||
71 | */ |
||
72 | public function findQuery($typeKey, array $criteria, array $fields = [], array $sort = [], array $pagination = [], array $inclusions = []); |
||
73 | |||
74 | /** |
||
75 | * Creates a new model. |
||
76 | * |
||
77 | * @param string $typeKey |
||
78 | * @param Rest\RestPayload $payload |
||
79 | * @return Rest\RestResponse |
||
80 | */ |
||
81 | public function createRecord($typeKey, Rest\RestPayload $payload); //, array $fields = [], array $inclusions = []); |
||
0 ignored issues
–
show
|
|||
82 | |||
83 | /** |
||
84 | * Updates an existing model. |
||
85 | * |
||
86 | * @param string $typeKey |
||
87 | * @param string $identifier |
||
88 | * @param Rest\RestPayload $payload |
||
89 | * @return Rest\RestResponse |
||
90 | */ |
||
91 | public function updateRecord($typeKey, $identifier, Rest\RestPayload $payload); // , array $fields = [], array $inclusions = []); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
53% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
92 | |||
93 | /** |
||
94 | * Deletes an existing model. |
||
95 | * |
||
96 | * @param string $typeKey |
||
97 | * @param string $identifier |
||
98 | * @return Rest\RestResponse |
||
99 | */ |
||
100 | public function deleteRecord($typeKey, $identifier); |
||
101 | |||
102 | /** |
||
103 | * Returns a set of autocomplete results for a model type, attribute, and search value. |
||
104 | * |
||
105 | * @param string $typeKey |
||
106 | * @param string $attributeKey |
||
107 | * @param string $searchValue |
||
108 | * @param array $pagination |
||
109 | * @return Rest\RestResponse |
||
110 | */ |
||
111 | public function autocomplete($typeKey, $attributeKey, $searchValue, array $pagination = []); |
||
112 | |||
113 | /** |
||
114 | * Handles errors and returns an appropriate REST response. |
||
115 | * |
||
116 | * @param \Exception $e |
||
117 | * @return Rest\RestResponse |
||
118 | */ |
||
119 | public function handleException(\Exception $e); |
||
120 | |||
121 | /** |
||
122 | * Gets the current REST request. |
||
123 | * |
||
124 | * @return Rest\RestRequest |
||
125 | */ |
||
126 | public function getRequest(); |
||
127 | |||
128 | /** |
||
129 | * Builds a URL for an entity, or an entity relationship. |
||
130 | * |
||
131 | * @param EntityMetadata $metadata |
||
132 | * @param string $identifier |
||
133 | * @param string|null $externalRelKey |
||
134 | * @param bool $isRelatedLink |
||
135 | * @return string |
||
136 | */ |
||
137 | public function buildUrl(EntityMetadata $metadata, $identifier, $externalRelKey = null, $isRelatedLink = false); |
||
138 | |||
139 | /** |
||
140 | * Gets the metadata for a model type. |
||
141 | * |
||
142 | * @param string $typeKey |
||
143 | * @return EntityMetadata |
||
144 | */ |
||
145 | public function getEntityMetadata($typeKey); |
||
146 | |||
147 | /** |
||
148 | * Gets the Store for handling persistence operations. |
||
149 | * |
||
150 | * @return Store |
||
151 | */ |
||
152 | public function getStore(); |
||
153 | |||
154 | /** |
||
155 | * Gets the Serializer for serializing resources. |
||
156 | * |
||
157 | * @return SerializerInterface |
||
158 | */ |
||
159 | public function getSerializer(); |
||
160 | |||
161 | /** |
||
162 | * Gets the Normalizer for normalizing REST payloads. |
||
163 | * |
||
164 | * @return NormalizerInterface |
||
165 | */ |
||
166 | public function getNormalizer(); |
||
167 | |||
168 | /** |
||
169 | * Normalizes a Rest\RestPayload into an array record to apply to a Model. |
||
170 | * Is used in conjunction with a SerializerInterface. |
||
171 | * |
||
172 | * @param Rest\RestPayload $payload |
||
173 | * @return array |
||
174 | */ |
||
175 | public function normalize(Rest\RestPayload $payload); |
||
176 | |||
177 | /** |
||
178 | * Serializes a Model into a Rest\RestPayload object. |
||
179 | * Is used in conjunction with a SerializerInterface. |
||
180 | * |
||
181 | * @param Model|null $model |
||
182 | * @return Rest\RestPayload |
||
183 | */ |
||
184 | public function serialize(Model $model = null); |
||
185 | |||
186 | /** |
||
187 | * Serializes a Collection into a Rest\RestPayload object. |
||
188 | * Is used in conjunction with a SerializerInterface. |
||
189 | * |
||
190 | * @param Collection $collection |
||
191 | * @return Rest\RestPayload |
||
192 | */ |
||
193 | public function serializeCollection(Collection $collection); |
||
194 | |||
195 | /** |
||
196 | * Serializes an array of Models into a Rest\RestPayload object. |
||
197 | * Is used in conjunction with a SerializerInterface. |
||
198 | * |
||
199 | * @param Model[] $models |
||
200 | * @return Rest\RestPayload |
||
201 | */ |
||
202 | public function serializeArray(array $models); |
||
203 | } |
||
204 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.