@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $resource = [ |
| 43 | 43 | 'kind' => 'AccessRule', |
| 44 | 44 | 'data' => $this->getData(), |
| 45 | - ]; |
|
| 45 | + ]; |
|
| 46 | 46 | |
| 47 | 47 | return AttributeResolver::resolve($request, $this, $resource); |
| 48 | 48 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($endpoint) { |
|
| 77 | + return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($endpoint) { |
|
| 78 | 78 | return $this->build($resource, $endpoint); |
| 79 | 79 | }); |
| 80 | 80 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function watch(EndpointInterface $endpoint, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 144 | 144 | { |
| 145 | - return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($endpoint) { |
|
| 145 | + return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($endpoint) { |
|
| 146 | 146 | return $this->build($resource, $endpoint); |
| 147 | 147 | }, $offset, $limit, $sort); |
| 148 | 148 | } |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | 'http' => [ |
| 123 | 123 | 'method' => $method, |
| 124 | 124 | 'header' => "Content-Type: application/json\r\n". |
| 125 | - 'Authorization: Basic '.base64_encode($this->username.':'.$this->password)."\r\n", |
|
| 125 | + 'Authorization: Basic '.base64_encode($this->username.':'.$this->password)."\r\n", |
|
| 126 | 126 | ], |
| 127 | 127 | ]; |
| 128 | 128 | |
@@ -48,12 +48,12 @@ |
||
| 48 | 48 | 'message' => $this->resource['message'], |
| 49 | 49 | 'created' => (new DateTime($this->resource['datetime']))->format('c'), |
| 50 | 50 | 'category' => $this->resource['context']['category'], |
| 51 | - 'exception' => function ($resource) use ($data) { |
|
| 51 | + 'exception' => function($resource) use ($data) { |
|
| 52 | 52 | if (isset($data['context']['exception'])) { |
| 53 | 53 | return $data['context']['exception']; |
| 54 | 54 | } |
| 55 | 55 | }, |
| 56 | - 'object' => function ($resource) use ($data) { |
|
| 56 | + 'object' => function($resource) use ($data) { |
|
| 57 | 57 | if (isset($data['context']['object'])) { |
| 58 | 58 | return $data['context']['object']; |
| 59 | 59 | } |
@@ -52,6 +52,10 @@ |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * watch all. |
| 55 | + * @param boolean $query |
|
| 56 | + * @param boolean $offset |
|
| 57 | + * @param boolean $limit |
|
| 58 | + * @param boolean $sort |
|
| 55 | 59 | */ |
| 56 | 60 | public function watch(?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
| 57 | 61 | { |
@@ -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']); |