Completed
Push — master ( b23853...6c4ac7 )
by hook
05:18 queued 02:51
created
work2.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 
10
-class Table{
10
+class Table {
11 11
     public function getuser()
12 12
     {
13 13
         return "ok";
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
         echo "class find\r\n";
21 21
 
22 22
         $t1 = microtime(true);
23
-        foreach (range(1,500) as $a){
23
+        foreach (range(1, 500) as $a) {
24 24
             $func = "get".$field;
25
-            if (method_exists($this,$func)) {
26
-                call_user_func([$this,$func]);
25
+            if (method_exists($this, $func)) {
26
+                call_user_func([ $this, $func ]);
27 27
             }
28 28
         }
29 29
 
30
-        var_dump(microtime(true)-$t1);
30
+        var_dump(microtime(true) - $t1);
31 31
 
32 32
 
33 33
 
34 34
         echo "array find\r\n";
35 35
         $t1 = microtime(true);
36
-        foreach (range(1,500) as $a) {
37
-            $a = ['set.user' => 'getuser', 'get.user' => 'getuser'];
38
-            $func = 'set.' . $field;
36
+        foreach (range(1, 500) as $a) {
37
+            $a = [ 'set.user' => 'getuser', 'get.user' => 'getuser' ];
38
+            $func = 'set.'.$field;
39 39
 //            if (isset($a[$func])) {
40
-                call_user_func([$this, $a[$func]]);
40
+                call_user_func([ $this, $a[ $func ] ]);
41 41
 //            }
42 42
         }
43
-        var_dump(microtime(true)-$t1);
43
+        var_dump(microtime(true) - $t1);
44 44
     }
45 45
 }
46 46
 
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 namespace Hoooklife\DynamodbPodm;
3 3
 use Hoooklife\DynamodbPodm\Query\Builder;
4 4
 class DB {
5
-    public static $config = [];
5
+    public static $config = [ ];
6 6
 
7 7
     public static function config(array $config)
8 8
     {
Please login to merge, or discard this patch.
test-sdk.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 
29 29
 $item = $marshaler->marshalJson('
30 30
     {
31
-        "year": ' . $year . ',
32
-        "title": "' . $title . '",
31
+        "year": ' . $year.',
32
+        "title": "' . $title.'",
33 33
         "info": {
34 34
             "plot": "Nothing happens at all.",
35 35
             "rating": 0
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 
53 53
 } catch (DynamoDbException $e) {
54 54
     echo "Unable to add item:\n";
55
-    echo $e->getMessage() . "\n";
55
+    echo $e->getMessage()."\n";
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
src/Collection.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function offsetExists($offset)
44 44
     {
45
-        return isset($this->data[$offset]);
45
+        return isset($this->data[ $offset ]);
46 46
     }
47 47
 
48 48
 
49 49
     public function offsetGet($offset)
50 50
     {
51
-        if (isset($this->data[$offset])) {
52
-            return $this->getMarshaler()->unmarshalItem($this->data[$offset]);
51
+        if (isset($this->data[ $offset ])) {
52
+            return $this->getMarshaler()->unmarshalItem($this->data[ $offset ]);
53 53
         }
54 54
         return null;
55 55
     }
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function offsetSet($offset, $value)
59 59
     {
60
-        $this->data[$offset] = $value;
60
+        $this->data[ $offset ] = $value;
61 61
     }
62 62
 
63 63
 
64 64
     public function offsetUnset($offset)
65 65
     {
66
-        unset($this->data[$offset]);
66
+        unset($this->data[ $offset ]);
67 67
     }
68 68
 
69 69
     public function toArray()
70 70
     {
71 71
 
72
-        $result = [];
73
-        foreach ($this->data["Items"] as $item) {
74
-            $result[] = $this->getMarshaler()->unmarshalItem($item);
72
+        $result = [ ];
73
+        foreach ($this->data[ "Items" ] as $item) {
74
+            $result[ ] = $this->getMarshaler()->unmarshalItem($item);
75 75
         }
76 76
         return $result;
77 77
     }
Please login to merge, or discard this patch.
src/Query/Builder.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
      * 查询排序
14 14
      */
15 15
     public $limit;
16
-    public $wheres = [];
17
-    public $bindings = [];
16
+    public $wheres = [ ];
17
+    public $bindings = [ ];
18 18
     public $columns;
19 19
     public $table;
20 20
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function __construct($connection = 'default')
39 39
     {
40
-        switch (DB::$config[$connection]['driver']) {
40
+        switch (DB::$config[ $connection ][ 'driver' ]) {
41 41
             case "dynamedb":
42
-                $this->grammar = new DynamoDBGrammar($this, DB::$config[$connection]);
42
+                $this->grammar = new DynamoDBGrammar($this, DB::$config[ $connection ]);
43 43
                 break;
44 44
             default:
45 45
                 throw new \Exception("bad driver");
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param  array|mixed $columns
54 54
      * @return $this
55 55
      */
56
-    public function select($columns = ['*'])
56
+    public function select($columns = [ '*' ])
57 57
     {
58 58
         $this->columns = is_array($columns) ? $columns : func_get_args();
59 59
         return $this;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function addSelect($columns)
64 64
     {
65 65
         $columns = is_array($columns) ? $columns : func_get_args();
66
-        $this->columns = array_merge((array)$this->columns, $columns);
66
+        $this->columns = array_merge((array) $this->columns, $columns);
67 67
         return $this;
68 68
     }
69 69
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         if (func_num_args() === 2 || $this->invalidOperator($operator)) {
110
-            list($value, $operator) = [$operator, '='];
110
+            list($value, $operator) = [ $operator, '=' ];
111 111
         }
112 112
 
113 113
         // where in
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
 
123 123
         $type = 'Basic';
124
-        $this->wheres[] = compact(
124
+        $this->wheres[ ] = compact(
125 125
             'type', 'column', 'operator', 'value', 'boolean'
126 126
         );
127 127
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function value($column)
239 239
     {
240
-        $result = (array)$this->first([$column]);
240
+        $result = (array) $this->first([ $column ]);
241 241
         return count($result) > 0 ? reset($result) : null;
242 242
     }
243 243
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param  array $columns
249 249
      * @return \Illuminate\Database\Eloquent\Model|object|static|null
250 250
      */
251
-    public function first($columns = ['*'])
251
+    public function first($columns = [ '*' ])
252 252
     {
253 253
         return reset($this->take(1)->all($columns));
254 254
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      * @param  array $columns
261 261
      * @return Collection
262 262
      */
263
-    public function all($columns = ['*']): Collection
263
+    public function all($columns = [ '*' ]): Collection
264 264
     {
265 265
         return $this->grammar->all($columns);
266 266
     }
Please login to merge, or discard this patch.
src/Grammars/DynamoDBBuilder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @var array
55 55
      */
56
-    public $query = [];
57
-    public $batchWriteItem = [];
56
+    public $query = [ ];
57
+    public $batchWriteItem = [ ];
58 58
 
59 59
     /** @var $dynamodbClient DynamoDbClient */
60 60
     protected $dynamodbClient;
61 61
 
62 62
     public function __construct(array $config)
63 63
     {
64
-        $this->dynamodbClient = new DynamoDbClient($config["S3Config"]);
64
+        $this->dynamodbClient = new DynamoDbClient($config[ "S3Config" ]);
65 65
     }
66 66
 
67 67
     public function hydrate(array $query)
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function setExpressionAttributeName($placeholder, $name)
74 74
     {
75
-        $this->query['ExpressionAttributeNames'][$placeholder] = $name;
75
+        $this->query[ 'ExpressionAttributeNames' ][ $placeholder ] = $name;
76 76
         return $this;
77 77
     }
78 78
 
79 79
     public function setExpressionAttributeValue($placeholder, $value)
80 80
     {
81
-        $this->query['ExpressionAttributeValues'][$placeholder] = $value;
81
+        $this->query[ 'ExpressionAttributeValues' ][ $placeholder ] = $value;
82 82
         return $this;
83 83
     }
84 84
 
85 85
     public function setKeyConditionExpression($mapping)
86 86
     {
87 87
         if ($mapping) {
88
-            $this->query['KeyConditionExpression'] = $mapping;
88
+            $this->query[ 'KeyConditionExpression' ] = $mapping;
89 89
         }
90 90
         return $this;
91 91
     }
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
     public function setExpressionAttributeValues($mapping)
94 94
     {
95 95
         if ($mapping) {
96
-            $this->query['ExpressionAttributeValues'] = $mapping;
96
+            $this->query[ 'ExpressionAttributeValues' ] = $mapping;
97 97
         }
98 98
         return $this;
99 99
     }
100 100
 
101 101
     public function setRequestItems($items)
102 102
     {
103
-        $this->batchWriteItem['RequestItems'] = $items;
103
+        $this->batchWriteItem[ 'RequestItems' ] = $items;
104 104
         return $this;
105 105
     }
106 106
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
     public function __call($method, $parameters)
130 130
     {
131 131
         if (strpos($method, 'set') === 0) {
132
-            $key = array_reverse(explode('set', $method, 2))[0];
133
-            $this->query[$key] = current($parameters);
132
+            $key = array_reverse(explode('set', $method, 2))[ 0 ];
133
+            $this->query[ $key ] = current($parameters);
134 134
             return $this;
135 135
         }
136 136
         throw new BadMethodCallException(sprintf(
Please login to merge, or discard this patch.
src/Grammars/DynamoDBGrammar.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 
11 11
 class DynamoDBGrammar
12 12
 {
13
-    protected $operators = [];
13
+    protected $operators = [ ];
14 14
 
15
-    protected $params = [];
15
+    protected $params = [ ];
16 16
 
17
-    protected $insertParam = [];
17
+    protected $insertParam = [ ];
18 18
 
19 19
     /**
20 20
      * @var Builder
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     private $dynamoDBBuilder;
29 29
 
30
-    private $attributeValues = [];
30
+    private $attributeValues = [ ];
31 31
 
32 32
     /** @var Marshaler $marshaler */
33 33
     private $marshaler;
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     // 表达式解析 where
51 51
     private function parseKeyConditionExpression()
52 52
     {
53
-        $expression = [];
53
+        $expression = [ ];
54 54
         foreach ($this->builder->wheres as $index => $where) {
55
-            $expression[] = "{$where['column']} {$where['operator']} :{$index}";
55
+            $expression[ ] = "{$where[ 'column' ]} {$where[ 'operator' ]} :{$index}";
56 56
             // param bind
57
-            $this->attributeValues[':' . $index] = $where['value'];
57
+            $this->attributeValues[ ':'.$index ] = $where[ 'value' ];
58 58
         }
59 59
         return implode("and", $expression);
60 60
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->createInsertParam($data);
95 95
 
96 96
         $builder = $this->dynamoDBBuilder
97
-            ->setRequestItems([$this->builder->table => $this->insertParam]);
97
+            ->setRequestItems([ $this->builder->table => $this->insertParam ]);
98 98
 
99 99
         return $builder->batchWriteItem();
100 100
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             if (is_numeric($key) && is_array($value)) {
106 106
                 $this->createInsertParam($value);
107 107
             } else {
108
-                $this->insertParam[] = [
108
+                $this->insertParam[ ] = [
109 109
                     'PutRequest' => [
110 110
                         'Item' => $this->marshaler->marshalItem($data)
111 111
                     ]
Please login to merge, or discard this patch.