@@ -42,14 +42,14 @@ discard block |
||
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 |
||
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 | } |
@@ -13,8 +13,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -53,15 +53,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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( |
@@ -10,11 +10,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ] |