@@ -44,7 +44,7 @@ |
||
44 | 44 | ], |
45 | 45 | 'kind' => 'Secret', |
46 | 46 | 'data' => $this->getData(), |
47 | - ]; |
|
47 | + ]; |
|
48 | 48 | |
49 | 49 | return AttributeResolver::resolve($request, $this, $resource); |
50 | 50 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | /*'data' => [ |
60 | 60 | 'context' => $this->resource['context'], |
61 | 61 | ]*/ |
62 | - 'object' => function () use ($related, $request) { |
|
62 | + 'object' => function() use ($related, $request) { |
|
63 | 63 | return $related->decorate($request); |
64 | 64 | }, |
65 | 65 | ]; |
@@ -51,9 +51,9 @@ |
||
51 | 51 | $related = $this->related_object; |
52 | 52 | $resource = [ |
53 | 53 | '_links' => [ |
54 | - 'self' => ['href' => (string) $request->getUri()], |
|
55 | - //'namespace' => ['href' => ($namespace = (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace->getName()))], |
|
56 | - //'collection' => ['href' => $namespace.'/collections'.$collection->getName()], |
|
54 | + 'self' => ['href' => (string) $request->getUri()], |
|
55 | + //'namespace' => ['href' => ($namespace = (string) $request->getUri()->withPath('/api/v1/namespaces/'.$namespace->getName()))], |
|
56 | + //'collection' => ['href' => $namespace.'/collections'.$collection->getName()], |
|
57 | 57 | ], |
58 | 58 | 'kind' => 'DataObjectRelation', |
59 | 59 | /*'data' => [ |
@@ -73,7 +73,7 @@ |
||
73 | 73 | ], |
74 | 74 | 'kind' => 'Job', |
75 | 75 | 'data' => $this->getData(), |
76 | - 'status' => function () use ($resource, $scheduler) { |
|
76 | + 'status' => function() use ($resource, $scheduler) { |
|
77 | 77 | $process = iterator_to_array($scheduler->getJobs([ |
78 | 78 | 'data.job' => $resource->getId(), |
79 | 79 | ])); |
@@ -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 | } |
@@ -163,6 +163,9 @@ |
||
163 | 163 | |
164 | 164 | /** |
165 | 165 | * Change stream. |
166 | + * @param boolean $after |
|
167 | + * @param boolean $query |
|
168 | + * @param boolean $offset |
|
166 | 169 | */ |
167 | 170 | public function watch(DataObjectInterface $object, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
168 | 171 | { |
@@ -112,7 +112,7 @@ |
||
112 | 112 | 'namespace_2' => $object_2->getCollection()->getResourceNamespace()->getName(), |
113 | 113 | 'object_2' => $object_2->getId(), |
114 | 114 | 'data' => $context, |
115 | - ]; |
|
115 | + ]; |
|
116 | 116 | |
117 | 117 | $exists = $this->db->{self::COLLECTION_NAME}->findOne([ |
118 | 118 | '$or' => [ |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ]; |
89 | 89 | } |
90 | 90 | |
91 | - return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function (array $resource) use ($object) { |
|
91 | + return $this->getAllFrom($this->db->{self::COLLECTION_NAME}, $filter, $offset, $limit, $sort, function(array $resource) use ($object) { |
|
92 | 92 | if ($resource['object_1'] == $object->getId()) { |
93 | 93 | $related = $object->getCollection()->getResourceNamespace()->switch($resource['namespace_2'])->getCollection($resource['collection_2'])->getObject(['_id' => $resource['object_2']]); |
94 | 94 | } else { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function watch(DataObjectInterface $object, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
168 | 168 | { |
169 | - return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function (array $resource) use ($object) { |
|
169 | + return $this->watchFrom($this->db->{self::COLLECTION_NAME}, $after, $existing, $query, function(array $resource) use ($object) { |
|
170 | 170 | return $this->build($resource, $object, $object); |
171 | 171 | }, $offset, $limit, $sort); |
172 | 172 | } |
@@ -63,6 +63,10 @@ discard block |
||
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Get all. |
66 | + * @param integer $query |
|
67 | + * @param integer $offset |
|
68 | + * @param integer $limit |
|
69 | + * @param integer $sort |
|
66 | 70 | */ |
67 | 71 | public function getAll(?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
68 | 72 | { |
@@ -144,6 +148,10 @@ discard block |
||
144 | 148 | |
145 | 149 | /** |
146 | 150 | * Change stream. |
151 | + * @param boolean $query |
|
152 | + * @param boolean $offset |
|
153 | + * @param boolean $limit |
|
154 | + * @param boolean $sort |
|
147 | 155 | */ |
148 | 156 | public function watch(?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
149 | 157 | { |