@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } catch (DynamoDbException $ex) { |
| 143 | 143 | $this->throwAwsPutError($ex); |
| 144 | 144 | } catch (\Exception $ex) { |
| 145 | - throw new RestException($ex->getMessage(), ['result'=>empty($res)?null:$res]); |
|
| 145 | + throw new RestException($ex->getMessage(), ['result'=>empty($res) ? null : $res]); |
|
| 146 | 146 | } |
| 147 | 147 | return $newResource; |
| 148 | 148 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $res = $this->client->deleteItem($query); |
| 166 | 166 | return $resourceId; |
| 167 | 167 | } catch (\Exception $ex) { |
| 168 | - throw new RestException($ex->getMessage(), ['result'=>empty($res)?null:$res]); |
|
| 168 | + throw new RestException($ex->getMessage(), ['result'=>empty($res) ? null : $res]); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $uniqueAndSetAndIndexed = array_intersect($uniqueAndSet, $indexes); //Is unique and value is set and is indexed |
| 35 | 35 | sort($uniqueAndSet); |
| 36 | 36 | sort($uniqueAndSetAndIndexed); |
| 37 | - return $uniqueAndSet===$uniqueAndSetAndIndexed; |
|
| 37 | + return $uniqueAndSet === $uniqueAndSetAndIndexed; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | protected function scanUniqueFields($fields) |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $filter = $this->generateScanFilter($fields); |
| 61 | 61 | if (property_exists($this->resource, $this->primaryKey)) { |
| 62 | 62 | $marshaler = new Marshaler; |
| 63 | - $filter['FilterExpression'] = '('.$filter['FilterExpression'].') AND #pk<>:pk'; |
|
| 63 | + $filter['FilterExpression'] = '(' . $filter['FilterExpression'] . ') AND #pk<>:pk'; |
|
| 64 | 64 | $filter['ExpressionAttributeNames']['#pk'] = $this->primaryKey; |
| 65 | 65 | $filter['ExpressionAttributeValues'][':pk'] = $marshaler->marshalValue( |
| 66 | 66 | $this->resource->{$this->primaryKey} |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | ]; |
| 85 | 85 | foreach ($fields as $field) { |
| 86 | 86 | if (property_exists($this->resource, $field)) { |
| 87 | - $ret['FilterExpression'] .= '#'.$field.'=:'.$field.' OR '; |
|
| 88 | - $ret['ExpressionAttributeNames']['#'.$field] = $field; |
|
| 89 | - $ret['ExpressionAttributeValues'][':'.$field] = $marshaler->marshalValue( |
|
| 87 | + $ret['FilterExpression'] .= '#' . $field . '=:' . $field . ' OR '; |
|
| 88 | + $ret['ExpressionAttributeNames']['#' . $field] = $field; |
|
| 89 | + $ret['ExpressionAttributeValues'][':' . $field] = $marshaler->marshalValue( |
|
| 90 | 90 | $this->resource->{$field} |
| 91 | 91 | ); |
| 92 | 92 | } |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | $marshaler = new Marshaler; |
| 131 | 131 | $query = [ |
| 132 | 132 | 'TableName' => $this->database->getDatabaseName() . '-' . $this->resourceName, |
| 133 | - 'KeyConditionExpression' => '#'.$field.'=:'.$field, |
|
| 133 | + 'KeyConditionExpression' => '#' . $field . '=:' . $field, |
|
| 134 | 134 | 'IndexName' => $this->indexNames[$field], |
| 135 | - 'ExpressionAttributeNames' => ['#'.$field => $field], |
|
| 136 | - 'ExpressionAttributeValues' => [':'.$field => $marshaler->marshalValue( |
|
| 135 | + 'ExpressionAttributeNames' => ['#' . $field => $field], |
|
| 136 | + 'ExpressionAttributeValues' => [':' . $field => $marshaler->marshalValue( |
|
| 137 | 137 | $this->resource->{$field} |
| 138 | 138 | )], |
| 139 | 139 | ]; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | protected function generatePromise($client, $query) |
| 161 | 161 | { |
| 162 | 162 | $promise = new Promise( |
| 163 | - function () use (&$promise, $client, $query) { |
|
| 163 | + function() use (&$promise, $client, $query) { |
|
| 164 | 164 | $q = new Query($client, $query); |
| 165 | 165 | while ($res = $q->next()) { |
| 166 | 166 | if ($res['Count'] !== 0) { |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | include_once __DIR__ . '/vendor/autoload.php'; |
| 3 | -if (!is_file(__DIR__. '/clusterpoint.php')) { |
|
| 4 | - copy(__DIR__. '/clusterpoint-example.php', __DIR__. '/clusterpoint.php'); |
|
| 3 | +if (!is_file(__DIR__ . '/clusterpoint.php')) { |
|
| 4 | + copy(__DIR__ . '/clusterpoint-example.php', __DIR__ . '/clusterpoint.php'); |
|
| 5 | 5 | } |
| 6 | -if (!is_file(__DIR__. '/.env')) { |
|
| 7 | - copy(__DIR__. '/.env-example', __DIR__. '/.env'); |
|
| 6 | +if (!is_file(__DIR__ . '/.env')) { |
|
| 7 | + copy(__DIR__ . '/.env-example', __DIR__ . '/.env'); |
|
| 8 | 8 | } |
| 9 | -if (is_file(__DIR__. '/.env')) { |
|
| 9 | +if (is_file(__DIR__ . '/.env')) { |
|
| 10 | 10 | $dotenv = new Dotenv\Dotenv(__DIR__); |
| 11 | 11 | $dotenv->load(); |
| 12 | 12 | } |