@@ -7,6 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class Finder extends BaseFinder |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param \Clusterpoint\Instance\Service $collection |
|
| 12 | + */ |
|
| 10 | 13 | protected function setLimit($collection) |
| 11 | 14 | { |
| 12 | 15 | if ($this->queryConfiguration->limit !== null) { |
@@ -14,6 +17,9 @@ discard block |
||
| 14 | 17 | } |
| 15 | 18 | } |
| 16 | 19 | |
| 20 | + /** |
|
| 21 | + * @param \Clusterpoint\Instance\Service $collection |
|
| 22 | + */ |
|
| 17 | 23 | protected function setOffset($collection) |
| 18 | 24 | { |
| 19 | 25 | if ($this->queryConfiguration->offset !== null) { |
@@ -21,6 +27,9 @@ discard block |
||
| 21 | 27 | } |
| 22 | 28 | } |
| 23 | 29 | |
| 30 | + /** |
|
| 31 | + * @param \Clusterpoint\Instance\Service $collection |
|
| 32 | + */ |
|
| 24 | 33 | protected function setOrderBy($collection) |
| 25 | 34 | { |
| 26 | 35 | foreach ($this->queryConfiguration->orderBy as $orderBy) { |
@@ -28,6 +37,9 @@ discard block |
||
| 28 | 37 | } |
| 29 | 38 | } |
| 30 | 39 | |
| 40 | + /** |
|
| 41 | + * @param \Clusterpoint\Instance\Service $collection |
|
| 42 | + */ |
|
| 31 | 43 | protected function setSelect($collection) |
| 32 | 44 | { |
| 33 | 45 | if ($this->queryConfiguration->select !== '*') { |
@@ -35,6 +47,9 @@ discard block |
||
| 35 | 47 | } |
| 36 | 48 | } |
| 37 | 49 | |
| 50 | + /** |
|
| 51 | + * @param \Clusterpoint\Instance\Service $collection |
|
| 52 | + */ |
|
| 38 | 53 | protected function setWhere($collection) |
| 39 | 54 | { |
| 40 | 55 | if (!empty($this->queryConfiguration->where)) { |
@@ -84,7 +99,7 @@ discard block |
||
| 84 | 99 | |
| 85 | 100 | /** |
| 86 | 101 | * @param string $logical |
| 87 | - * @return \Clusterpoint\Instance\Service |
|
| 102 | + * @return \Closure |
|
| 88 | 103 | */ |
| 89 | 104 | protected function addWhereGroup($collection, $conditions, $logical) |
| 90 | 105 | { |
@@ -110,6 +125,9 @@ discard block |
||
| 110 | 125 | } |
| 111 | 126 | } |
| 112 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $logical |
|
| 130 | + */ |
|
| 113 | 131 | private function parseWhere($collection, $conditions, $logical) |
| 114 | 132 | { |
| 115 | 133 | foreach ($conditions as $key => $condition) { |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | $collection = $this->client->database( |
| 66 | - $this->queryConfiguration->databaseName. |
|
| 66 | + $this->queryConfiguration->databaseName . |
|
| 67 | 67 | '.' . |
| 68 | 68 | $this->queryConfiguration->from |
| 69 | 69 | ); |
@@ -139,10 +139,10 @@ |
||
| 139 | 139 | $marshaler = new Marshaler; |
| 140 | 140 | $query = [ |
| 141 | 141 | 'TableName' => $this->database->getDatabaseName() . '-' . $this->resourceName, |
| 142 | - 'KeyConditionExpression' => '#'.$field.'=:'.$field, |
|
| 142 | + 'KeyConditionExpression' => '#' . $field . '=:' . $field, |
|
| 143 | 143 | 'IndexName' => $this->indexNames[$field], |
| 144 | - 'ExpressionAttributeNames' => ['#'.$field => $field], |
|
| 145 | - 'ExpressionAttributeValues' => [':'.$field => $marshaler->marshalValue( |
|
| 144 | + 'ExpressionAttributeNames' => ['#' . $field => $field], |
|
| 145 | + 'ExpressionAttributeValues' => [':' . $field => $marshaler->marshalValue( |
|
| 146 | 146 | $this->resource->{$field} |
| 147 | 147 | )], |
| 148 | 148 | ]; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $query->where($this->primaryKey, '!=', $this->getPrimaryKeyValue()); |
| 45 | 45 | } |
| 46 | 46 | // @codeCoverageIgnoreStart |
| 47 | - $query->where(function ($query) use ($uniqueFields) { |
|
| 47 | + $query->where(function($query) use ($uniqueFields) { |
|
| 48 | 48 | foreach ($uniqueFields as $fieldName) { |
| 49 | 49 | if (property_exists($this->resource, $fieldName)) { |
| 50 | 50 | $query->orWhere($fieldName, '==', $this->resource->{$fieldName}); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function query() |
| 67 | 67 | { |
| 68 | - $query = $this->getClient()->database($this->getDatabaseName().'.'.$this->resourceName); |
|
| 68 | + $query = $this->getClient()->database($this->getDatabaseName() . '.' . $this->resourceName); |
|
| 69 | 69 | return $query; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -100,8 +100,7 @@ |
||
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | $message = $res->error()[0]->message === 'Requested document does not exist' ? |
| 103 | - 'Resource does not exist' : |
|
| 104 | - 'Database operation failed'; |
|
| 103 | + 'Resource does not exist' : 'Database operation failed'; |
|
| 105 | 104 | throw new RestException( |
| 106 | 105 | $message, |
| 107 | 106 | [ |