@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public static function collect() |
22 | 22 | { |
23 | - return FastRoute\simpleDispatcher(function (FastRoute\RouteCollector $r) { |
|
23 | + return FastRoute\simpleDispatcher(function(FastRoute\RouteCollector $r) { |
|
24 | 24 | $r->addRoute('GET', '/api', [v1\Api::class, 'get']); |
25 | 25 | $r->addRoute('GET', '/api/v1', [v1\Api::class, 'get']); |
26 | 26 | $r->addRoute('GET', '/spec/api/v1', [Specifications::class, 'getApiv1']); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $that = $this; |
64 | 64 | |
65 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function ($resource) use ($that) { |
|
65 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function($resource) use ($that) { |
|
66 | 66 | return $that->build($resource); |
67 | 67 | }); |
68 | 68 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $that = $this; |
132 | 132 | |
133 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function ($resource) use ($that) { |
|
133 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function($resource) use ($that) { |
|
134 | 134 | return $that->build($resource); |
135 | 135 | }, $offset, $limit, $sort); |
136 | 136 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $resource_factory = $this->resource_factory; |
156 | 156 | $db = $this->db; |
157 | 157 | |
158 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($object, $relation, $logger, $resource_factory, $db, $that) { |
|
158 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($object, $relation, $logger, $resource_factory, $db, $that) { |
|
159 | 159 | $object_1 = $resource['data']['relation'][0]; |
160 | 160 | $object_2 = $resource['data']['relation'][1]; |
161 | 161 | $related = $object_1; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $filter = $this->prepareQuery($namespace, $query); |
190 | 190 | $that = $this; |
191 | 191 | |
192 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($that) { |
|
192 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($that) { |
|
193 | 193 | return $that->build($resource); |
194 | 194 | }); |
195 | 195 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $filter = $this->prepareQuery($namespace, $query); |
336 | 336 | $that = $this; |
337 | 337 | |
338 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function (array $resource) use ($that) { |
|
338 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function(array $resource) use ($that) { |
|
339 | 339 | return $that->build($resource); |
340 | 340 | }, $offset, $limit, $sort); |
341 | 341 | } |
@@ -183,6 +183,8 @@ discard block |
||
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Get all. |
186 | + * @param integer $offset |
|
187 | + * @param integer $limit |
|
186 | 188 | */ |
187 | 189 | public function getAll(ResourceNamespaceInterface $namespace, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
188 | 190 | { |
@@ -329,6 +331,8 @@ discard block |
||
329 | 331 | |
330 | 332 | /** |
331 | 333 | * Change stream. |
334 | + * @param integer $offset |
|
335 | + * @param integer $limit |
|
332 | 336 | */ |
333 | 337 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
334 | 338 | { |
@@ -342,6 +346,7 @@ discard block |
||
342 | 346 | |
343 | 347 | /** |
344 | 348 | * Build. |
349 | + * @param DataObjectInterface $object |
|
345 | 350 | */ |
346 | 351 | public function build(array $resource, ?DataObjectInterface $object = null): DataObjectRelationInterface |
347 | 352 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $that = $this; |
103 | 103 | |
104 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function (array $resource) use ($that) { |
|
104 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $query, $offset, $limit, $sort, function(array $resource) use ($that) { |
|
105 | 105 | return $that->build($resource); |
106 | 106 | }); |
107 | 107 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $that = $this; |
175 | 175 | |
176 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($that) { |
|
176 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($that) { |
|
177 | 177 | return $that->build($resource); |
178 | 178 | }, $offset, $limit, $sort); |
179 | 179 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $filter = $this->prepareQuery($namespace, $query); |
94 | 94 | $that = $this; |
95 | 95 | |
96 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace, $that) { |
|
96 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace, $that) { |
|
97 | 97 | return $that->build($resource, $namespace); |
98 | 98 | }); |
99 | 99 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $filter = $this->prepareQuery($namespace, $query); |
231 | 231 | $that = $this; |
232 | 232 | |
233 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function (array $resource) use ($namespace, $that) { |
|
233 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function(array $resource) use ($namespace, $that) { |
|
234 | 234 | return $that->build($resource, $namespace); |
235 | 235 | }, $offset, $limit, $sort); |
236 | 236 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $filter = $this->prepareQuery($namespace, $query); |
94 | 94 | $that = $this; |
95 | 95 | |
96 | - return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace, $that) { |
|
96 | + return $this->resource_factory->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace, $that) { |
|
97 | 97 | return $that->build($resource, $namespace); |
98 | 98 | }); |
99 | 99 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $filter = $this->prepareQuery($namespace, $query); |
231 | 231 | $that = $this; |
232 | 232 | |
233 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function (array $resource) use ($namespace, $that) { |
|
233 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $filter, function(array $resource) use ($namespace, $that) { |
|
234 | 234 | return $that->build($resource, $namespace); |
235 | 235 | }, $offset, $limit, $sort); |
236 | 236 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'body' => [ |
287 | 287 | '@odata.id' => self::API_ENDPOINT.'/directoryObjects/'.$member, |
288 | 288 | ], |
289 | - 'headers' => [ |
|
289 | + 'headers' => [ |
|
290 | 290 | 'Content-Type' => 'application/json', |
291 | 291 | ], |
292 | 292 | ]; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | 'id' => 'remove-'.$type.'-'.$member, |
298 | 298 | 'method' => 'DELETE', |
299 | 299 | 'url' => '/groups/'.$id.'/'.$type.'/'.$member.'/$ref', |
300 | - 'headers' => [ |
|
300 | + 'headers' => [ |
|
301 | 301 | 'Content-Type' => 'application/json', |
302 | 302 | ], |
303 | 303 | ]; |
@@ -349,6 +349,7 @@ |
||
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Validate batch request. |
352 | + * @param \Psr\Http\Message\ResponseInterface $response |
|
352 | 353 | */ |
353 | 354 | protected function validateBatchResponse($response, bool $throw = true): array |
354 | 355 | { |
@@ -89,7 +89,7 @@ |
||
89 | 89 | 'kind' => 'Job', |
90 | 90 | 'namespace' => $this->namespace->getName(), |
91 | 91 | 'data' => $this->getData(), |
92 | - 'status' => function () use ($resource, $scheduler) { |
|
92 | + 'status' => function() use ($resource, $scheduler) { |
|
93 | 93 | $process = iterator_to_array($scheduler->getJobs([ |
94 | 94 | 'data.job' => $resource->getName(), |
95 | 95 | 'data.namespace' => $this->namespace->getName(), |
@@ -107,6 +107,7 @@ |
||
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Select query. |
110 | + * @param string $query |
|
110 | 111 | */ |
111 | 112 | public function query($query, $resultmode = null) |
112 | 113 | { |
@@ -142,17 +142,17 @@ |
||
142 | 142 | $types = ''; |
143 | 143 | foreach ($values as $attr => $value) { |
144 | 144 | switch (gettype($value)) { |
145 | - case 'integer': |
|
146 | - $types .= 'i'; |
|
145 | + case 'integer': |
|
146 | + $types .= 'i'; |
|
147 | 147 | |
148 | - break; |
|
149 | - case 'double': |
|
150 | - $types .= 'd'; |
|
148 | + break; |
|
149 | + case 'double': |
|
150 | + $types .= 'd'; |
|
151 | 151 | |
152 | - break; |
|
153 | - default: |
|
154 | - case 'string': |
|
155 | - $types .= 's'; |
|
152 | + break; |
|
153 | + default: |
|
154 | + case 'string': |
|
155 | + $types .= 's'; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 |