@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function getAllFrom(Collection $collection, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null, ?Closure $build = null): Generator |
144 | 144 | { |
145 | 145 | if ($build === null) { |
146 | - $build = function ($resource) { |
|
146 | + $build = function($resource) { |
|
147 | 147 | return $this->build($resource); |
148 | 148 | }; |
149 | 149 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function watchFrom(Collection $collection, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = [], ?Closure $build = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
171 | 171 | { |
172 | 172 | if ($build === null) { |
173 | - $build = function ($resource) { |
|
173 | + $build = function($resource) { |
|
174 | 174 | return $this->build($resource); |
175 | 175 | }; |
176 | 176 | } |
@@ -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 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getAll(CollectionInterface $collection, ?array $query = null, bool $include_dataset = true, ?int $offset = 0, ?int $limit = 0, ?array $sort = ['$natural' => -1]): Generator |
118 | 118 | { |
119 | - return $this->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function (array $resource) use ($collection) { |
|
119 | + return $this->getAllFrom($this->db->{$collection->getCollection()}, $query, $offset, $limit, $sort, function(array $resource) use ($collection) { |
|
120 | 120 | return $this->build($resource, $collection); |
121 | 121 | }); |
122 | 122 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | 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 | 190 | { |
191 | - return $this->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function (array $resource) use ($collection) { |
|
191 | + return $this->watchFrom($this->db->{$collection->getCollection()}, $after, $existing, $query, function(array $resource) use ($collection) { |
|
192 | 192 | return $this->build($collection, $resource); |
193 | 193 | }, $offset, $limit, $sort); |
194 | 194 | } |
@@ -133,6 +133,8 @@ discard block |
||
133 | 133 | |
134 | 134 | /** |
135 | 135 | * {@inheritdoc} |
136 | + * @param integer $offset |
|
137 | + * @param integer $limit |
|
136 | 138 | */ |
137 | 139 | public function getAll(ResourceNamespaceInterface $namespace, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
138 | 140 | { |
@@ -266,6 +268,7 @@ discard block |
||
266 | 268 | |
267 | 269 | /** |
268 | 270 | * Build. |
271 | + * @param DataObjectInterface $object |
|
269 | 272 | */ |
270 | 273 | public function build(array $resource, ?DataObjectInterface $object = null): DataObjectRelationInterface |
271 | 274 | { |
@@ -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 | { |
@@ -118,6 +118,8 @@ |
||
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Change stream. |
121 | + * @param integer $offset |
|
122 | + * @param integer $limit |
|
121 | 123 | */ |
122 | 124 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
123 | 125 | { |
@@ -177,6 +177,8 @@ |
||
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Change stream. |
180 | + * @param integer $offset |
|
181 | + * @param integer $limit |
|
180 | 182 | */ |
181 | 183 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
182 | 184 | { |
@@ -79,7 +79,7 @@ |
||
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 | } |
@@ -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 | } |
@@ -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 { |