Passed
Branch feature/dynamodb (3d641a)
by Csaba
03:00
created
src/Database/DynamoDb/Resource.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Aws\DynamoDb\Marshaler;
7 7
 use Fathomminds\Rest\Exceptions\RestException;
8 8
 use Fathomminds\Rest\Contracts\IResource;
9
-use Fathomminds\Rest\Helpers\Uuid;
10 9
 use Aws\DynamoDb\Exception\DynamoDbException;
11 10
 
12 11
 class Resource implements IResource
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -85,6 +85,9 @@  discard block
 block discarded – undo
85 85
         return $query;
86 86
     }
87 87
 
88
+    /**
89
+     * @param DynamoDbException $exception
90
+     */
88 91
     protected function throwAwsPostError($exception)
89 92
     {
90 93
         switch ($exception->getAwsErrorCode()) {
@@ -121,6 +124,9 @@  discard block
 block discarded – undo
121 124
         return $query;
122 125
     }
123 126
 
127
+    /**
128
+     * @param DynamoDbException $exception
129
+     */
124 130
     protected function throwAwsPutError($exception)
125 131
     {
126 132
         switch ($exception->getAwsErrorCode()) {
Please login to merge, or discard this patch.
src/Database/DynamoDb/RestObject.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $indexedFields = array_intersect($uniqueFields, $indexes); //Is unique and value is set and is indexed
35 35
         sort($uniqueFields);
36 36
         sort($indexedFields);
37
-        return $uniqueFields===$indexedFields;
37
+        return $uniqueFields === $indexedFields;
38 38
     }
39 39
 
40 40
     protected function scanUniqueFields($fields)
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
160 160
     protected function generatePromise($client, $request)
161 161
     {
162 162
         $promise = new Promise(
163
-            function () use (&$promise, $client, $request) {
163
+            function() use (&$promise, $client, $request) {
164 164
                 $query = new Query($client, $request);
165 165
                 while ($res = $query->next()) {
166 166
                     if ($res['Count'] !== 0) {
Please login to merge, or discard this patch.