@@ -185,7 +185,7 @@ |
||
| 185 | 185 | '_links' => [ |
| 186 | 186 | 'namespace' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace)], |
| 187 | 187 | 'collection' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection)], |
| 188 | - ], |
|
| 188 | + ], |
|
| 189 | 189 | 'kind' => static::KIND, |
| 190 | 190 | 'namespace' => $namespace, |
| 191 | 191 | 'collection' => $collection, |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'namespace' => $namespace, |
| 179 | 179 | 'collection' => $collection, |
| 180 | 180 | 'data' => $this->getData(), |
| 181 | - 'status' => function ($endpoint) { |
|
| 181 | + 'status' => function($endpoint) { |
|
| 182 | 182 | try { |
| 183 | 183 | $endpoint->setup(); |
| 184 | 184 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | private function parseAttribute(string $string, array $data): string |
| 336 | 336 | { |
| 337 | - return preg_replace_callback('/(\{(([^\}\{\"]*)+)\})/', function ($match) use ($string, $data) { |
|
| 337 | + return preg_replace_callback('/(\{(([^\}\{\"]*)+)\})/', function($match) use ($string, $data) { |
|
| 338 | 338 | if (substr($match[0], 0, 2) === '{{' && $match[4][0] === '}') { |
| 339 | 339 | return $match[2].$match[4]; |
| 340 | 340 | } |
@@ -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', [v1\Api::class, 'get']); |
| 25 | 25 | $r->addRoute('GET', '/spec/api/v1', [Specifications::class, 'getApiv1']); |
| 26 | 26 | $r->addRoute('GET', '/api/v1/namespaces', [v1\ResourceNamespaces::class, 'getAll']); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | 'namespace' => $namespace, |
| 64 | 64 | 'collection' => $collection, |
| 65 | 65 | 'data' => $this->getData(), |
| 66 | - 'status' => function ($object) { |
|
| 66 | + 'status' => function($object) { |
|
| 67 | 67 | $endpoints = $object->getEndpoints(); |
| 68 | 68 | foreach ($endpoints as &$endpoint) { |
| 69 | 69 | $endpoint['last_sync'] = $endpoint['last_sync']->toDateTime()->format('c'); |
@@ -46,5 +46,5 @@ |
||
| 46 | 46 | /** |
| 47 | 47 | * Switch namespace. |
| 48 | 48 | */ |
| 49 | - public function switch(string $name): ResourceNamespaceInterface; |
|
| 49 | + public function switch (string $name): ResourceNamespaceInterface; |
|
| 50 | 50 | } |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | /** |
| 110 | 110 | * {@inheritdoc} |
| 111 | 111 | */ |
| 112 | - public function switch(string $name): ResourceNamespaceInterface |
|
| 112 | + public function switch (string $name): ResourceNamespaceInterface |
|
| 113 | 113 | { |
| 114 | 114 | return $this->namespace_factory->getOne($name); |
| 115 | 115 | } |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | 'data' => [ |
| 145 | 145 | 'schema' => $this->schema->getSchema(), |
| 146 | 146 | ], |
| 147 | - ]; |
|
| 147 | + ]; |
|
| 148 | 148 | |
| 149 | 149 | return AttributeResolver::resolve($request, $this, $resource); |
| 150 | 150 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $resource = [ |
| 44 | 44 | '_links' => [ |
| 45 | - 'self' => ['href' => (string) $request->getUri()], |
|
| 45 | + 'self' => ['href' => (string) $request->getUri()], |
|
| 46 | 46 | ], |
| 47 | 47 | 'kind' => 'DataObjectRelation', |
| 48 | 48 | 'namespace' => $this->resource['namespace'], |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $request = Zend\Diactoros\ServerRequestFactory::fromGlobals(); |
| 32 | 32 | $logger = $dic->get(Psr\Log\LoggerInterface::class); |
| 33 | 33 | |
| 34 | -set_exception_handler(function ($e) use ($logger) { |
|
| 34 | +set_exception_handler(function($e) use ($logger) { |
|
| 35 | 35 | http_response_code(500); |
| 36 | 36 | $logger->emergency('uncaught exception: '.$e->getMessage(), [ |
| 37 | 37 | 'category' => 'Http', |
@@ -185,6 +185,9 @@ |
||
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * Change stream. |
| 188 | + * @param boolean $offset |
|
| 189 | + * @param integer $limit |
|
| 190 | + * @param integer $sort |
|
| 188 | 191 | */ |
| 189 | 192 | public function watch(CollectionInterface $collection, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 190 | 193 | { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $that = $this; |
| 134 | 134 | |
| 135 | - return $this->resource_factory->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function (array $resource) use ($collection, $that) { |
|
| 135 | + return $this->resource_factory->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function(array $resource) use ($collection, $that) { |
|
| 136 | 136 | return $that->build($resource, $collection); |
| 137 | 137 | }); |
| 138 | 138 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | $that = $this; |
| 202 | 202 | |
| 203 | - return $this->resource_factory->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function (array $resource) use ($collection, $that) { |
|
| 203 | + return $this->resource_factory->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function(array $resource) use ($collection, $that) { |
|
| 204 | 204 | return $that->build($collection, $resource); |
| 205 | 205 | }, $offset, $limit, $sort); |
| 206 | 206 | } |