@@ -296,6 +296,7 @@ |
||
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * Process ruleset. |
| 299 | + * @return string |
|
| 299 | 300 | */ |
| 300 | 301 | protected function rewrite($value, array $ruleset) |
| 301 | 302 | { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | if ($attrv === null || is_string($attrv) && strlen($attrv) === 0 || is_array($attrv) && count($attrv) === 0) { |
| 201 | 201 | if (isset($value['required']) && $value['required'] === false || !isset($value['required'])) { |
| 202 | 202 | $this->logger->debug('found attribute ['.$attr.'] but source attribute is empty, remove attribute from mapping', [ |
| 203 | - 'category' => get_class($this), |
|
| 203 | + 'category' => get_class($this), |
|
| 204 | 204 | ]); |
| 205 | 205 | |
| 206 | 206 | return null; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $this->logger->debug('resolved value for attribute ['.$attribute.'] is an array but is not declared as an array, use first array element instead', [ |
| 291 | - 'category' => get_class($this), |
|
| 291 | + 'category' => get_class($this), |
|
| 292 | 292 | ]); |
| 293 | 293 | |
| 294 | 294 | return current($value); |
@@ -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, |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'namespace' => $namespace, |
| 191 | 191 | 'collection' => $collection, |
| 192 | 192 | 'data' => $this->getData(), |
| 193 | - 'status' => function ($endpoint) { |
|
| 193 | + 'status' => function($endpoint) { |
|
| 194 | 194 | try { |
| 195 | 195 | $endpoint->setup(); |
| 196 | 196 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | private function parseAttribute(string $string, array $data): string |
| 346 | 346 | { |
| 347 | - return preg_replace_callback('/(\{(([^\}\"]*)+)\})(\}?)/', function ($match) use ($string, $data) { |
|
| 347 | + return preg_replace_callback('/(\{(([^\}\"]*)+)\})(\}?)/', function($match) use ($string, $data) { |
|
| 348 | 348 | if (substr($match[0], 0, 2) === '{{' && $match[4][0] === '}') { |
| 349 | 349 | return $match[2].$match[4]; |
| 350 | 350 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ]; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($collection) { |
|
| 83 | + return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($collection) { |
|
| 84 | 84 | return $this->build($resource, $collection); |
| 85 | 85 | }); |
| 86 | 86 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function watch(CollectionInterface $collection, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 159 | 159 | { |
| 160 | - return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($collection) { |
|
| 160 | + return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($collection) { |
|
| 161 | 161 | return $this->build($resource, $collection); |
| 162 | 162 | }, $offset, $limit, $sort); |
| 163 | 163 | } |
@@ -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'); |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | 'namespace' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace)], |
| 116 | 116 | 'collection' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection)], |
| 117 | 117 | 'endpoint' => ['href' => (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace.'/collections/'.$collection.'/endpoints/'.$endpoint)], |
| 118 | - ], |
|
| 118 | + ], |
|
| 119 | 119 | 'kind' => 'Workflow', |
| 120 | 120 | 'namespace' => $namespace, |
| 121 | 121 | 'collection' => $collection, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ]; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($namespace) { |
|
| 82 | + return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($namespace) { |
|
| 83 | 83 | return $this->build($resource, $namespace); |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 145 | 145 | { |
| 146 | - return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($namespace) { |
|
| 146 | + return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($namespace) { |
|
| 147 | 147 | return $this->build($resource, $namespace); |
| 148 | 148 | }, $offset, $limit, $sort); |
| 149 | 149 | } |
@@ -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 | } |