@@ -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"); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | if (func_num_args() === 2 || $this->invalidOperator($operator)) { |
89 | - list($value, $operator) = [$operator, '=']; |
|
89 | + list($value, $operator) = [ $operator, '=' ]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // where in |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $type = 'Basic'; |
103 | - $this->wheres[] = compact( |
|
103 | + $this->wheres[ ] = compact( |
|
104 | 104 | 'type', 'column', 'operator', 'value', 'boolean' |
105 | 105 | ); |
106 | 106 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function value($column) |
218 | 218 | { |
219 | - $result = (array)$this->first([$column]); |
|
219 | + $result = (array) $this->first([ $column ]); |
|
220 | 220 | return count($result) > 0 ? reset($result) : null; |
221 | 221 | } |
222 | 222 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @param array $columns |
228 | 228 | * @return \Illuminate\Database\Eloquent\Model|object|static|null |
229 | 229 | */ |
230 | - public function first($columns = ['*']) |
|
230 | + public function first($columns = [ '*' ]) |
|
231 | 231 | { |
232 | 232 | return $this->take(1)->all($columns)->first(); |
233 | 233 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param array $columns |
240 | 240 | * @return Collection |
241 | 241 | */ |
242 | - public function all($columns = ['*']): Collection |
|
242 | + public function all($columns = [ '*' ]): Collection |
|
243 | 243 | { |
244 | 244 | $columns = is_array($columns) ? $columns : func_get_args(); |
245 | 245 | $this->columns = $columns; |
@@ -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,28 +57,28 @@ 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 | } |
78 | 78 | |
79 | 79 | public function first() |
80 | 80 | { |
81 | - $item = reset($this->data["Items"]); |
|
81 | + $item = reset($this->data[ "Items" ]); |
|
82 | 82 | return $this->getMarshaler()->unmarshalItem($item); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | \ No newline at end of file |