@@ -93,7 +93,7 @@ |
||
| 93 | 93 | protected function registerFunctions(): void |
| 94 | 94 | { |
| 95 | 95 | $this->crypt = [ |
| 96 | - 'hash' => function ($algo, $data, $raw_output = false) { |
|
| 96 | + 'hash' => function($algo, $data, $raw_output = false) { |
|
| 97 | 97 | return hash($algo, $data, $raw_output); |
| 98 | 98 | }, |
| 99 | 99 | ]; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $query = $request->getQueryParams(); |
| 74 | 74 | $options = isset($query['pretty']) ? JSON_PRETTY_PRINT : 0; |
| 75 | 75 | |
| 76 | - $stream = new StreamIterator($cursor, function ($resource) use ($request, $options) { |
|
| 76 | + $stream = new StreamIterator($cursor, function($resource) use ($request, $options) { |
|
| 77 | 77 | if ($this->tell() === 0) { |
| 78 | 78 | echo '['; |
| 79 | 79 | } else { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $query = $request->getQueryParams(); |
| 107 | 107 | $options = isset($query['pretty']) ? JSON_PRETTY_PRINT : 0; |
| 108 | 108 | |
| 109 | - $stream = new StreamIterator($cursor, function ($event) use ($request, $options) { |
|
| 109 | + $stream = new StreamIterator($cursor, function($event) use ($request, $options) { |
|
| 110 | 110 | if ($this->tell() === 0) { |
| 111 | 111 | echo '['; |
| 112 | 112 | } else { |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | 'kind' => 'Job', |
| 85 | 85 | 'namespace' => $this->namespace->getName(), |
| 86 | 86 | 'data' => $this->getData(), |
| 87 | - 'status' => function () use ($resource, $scheduler) { |
|
| 87 | + 'status' => function() use ($resource, $scheduler) { |
|
| 88 | 88 | $process = iterator_to_array($scheduler->getJobs([ |
| 89 | 89 | 'data.job' => $resource->getName(), |
| 90 | 90 | 'data.parent' => ['$exists' => false], |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | 'kind' => 'Secret', |
| 48 | 48 | 'namespace' => $this->namespace->getName(), |
| 49 | 49 | 'data' => $this->getData(), |
| 50 | - ]; |
|
| 50 | + ]; |
|
| 51 | 51 | |
| 52 | 52 | return AttributeResolver::resolve($request, $this, $resource); |
| 53 | 53 | } |
@@ -180,6 +180,8 @@ |
||
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * Change stream. |
| 183 | + * @param integer $offset |
|
| 184 | + * @param integer $limit |
|
| 183 | 185 | */ |
| 184 | 186 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 185 | 187 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $that = $this; |
| 84 | 84 | |
| 85 | - return $this->resource_factory->getAllFrom($this->db->{$this->scheduler->getJobQueue()}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace, $that) { |
|
| 85 | + return $this->resource_factory->getAllFrom($this->db->{$this->scheduler->getJobQueue()}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace, $that) { |
|
| 86 | 86 | return $that->build($resource, $namespace); |
| 87 | 87 | }); |
| 88 | 88 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $that = $this; |
| 142 | 142 | |
| 143 | - return $this->resource_factory->watchFrom($this->db->{$this->scheduler->getJobQueue()}, $after, $existing, $query, function (array $resource) use ($namespace, $that) { |
|
| 143 | + return $this->resource_factory->watchFrom($this->db->{$this->scheduler->getJobQueue()}, $after, $existing, $query, function(array $resource) use ($namespace, $that) { |
|
| 144 | 144 | return $that->build($resource, $namespace); |
| 145 | 145 | }, $offset, $limit, $sort); |
| 146 | 146 | } |
@@ -375,6 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | /** |
| 377 | 377 | * Parse response. |
| 378 | + * @param \Psr\Http\Message\ResponseInterface $response |
|
| 378 | 379 | */ |
| 379 | 380 | protected function parse($response): array |
| 380 | 381 | { |
@@ -409,6 +410,7 @@ discard block |
||
| 409 | 410 | |
| 410 | 411 | /** |
| 411 | 412 | * Get identifier. |
| 413 | + * @return string |
|
| 412 | 414 | */ |
| 413 | 415 | protected function getResourceId(array $object, array $endpoint_object = []): ?string |
| 414 | 416 | { |
@@ -64,6 +64,8 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Get all. |
| 67 | + * @param integer $offset |
|
| 68 | + * @param integer $limit |
|
| 67 | 69 | */ |
| 68 | 70 | public function getAll(ResourceNamespaceInterface $namespace, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 69 | 71 | { |
@@ -183,6 +185,8 @@ discard block |
||
| 183 | 185 | |
| 184 | 186 | /** |
| 185 | 187 | * Change stream. |
| 188 | + * @param integer $offset |
|
| 189 | + * @param integer $limit |
|
| 186 | 190 | */ |
| 187 | 191 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 188 | 192 | { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 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 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | $that = $this; |
| 206 | 206 | |
| 207 | - return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($namespace, $that) { |
|
| 207 | + return $this->resource_factory->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($namespace, $that) { |
|
| 208 | 208 | return $that->build($resource, $namespace); |
| 209 | 209 | }, $offset, $limit, $sort); |
| 210 | 210 | } |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use Psr\Http\Server\MiddlewareInterface; |
| 19 | 19 | use Psr\Http\Server\RequestHandlerInterface; |
| 20 | 20 | use Tubee\Rest\Exception; |
| 21 | -use Zend\Diactoros\Response; |
|
| 22 | 21 | |
| 23 | 22 | class QueryDecoder implements MiddlewareInterface |
| 24 | 23 | { |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use Tubee\Resource\AbstractResource; |
| 19 | 19 | use Tubee\Resource\AttributeResolver; |
| 20 | 20 | use Tubee\V8\Engine as V8Engine; |
| 21 | -use Tubee\Workflow\Map; |
|
| 22 | 21 | use Tubee\Workflow\WorkflowInterface; |
| 23 | 22 | use V8Js; |
| 24 | 23 | |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | 'namespace' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace)], |
| 122 | 122 | 'collection' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection)], |
| 123 | 123 | 'endpoint' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection.'/endpoints/'.$endpoint)], |
| 124 | - ], |
|
| 124 | + ], |
|
| 125 | 125 | 'namespace' => $namespace, |
| 126 | 126 | 'collection' => $collection, |
| 127 | 127 | 'endpoint' => $endpoint, |