@@ -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 reset($this->take(1)->all($columns)); |
| 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; |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @var array |
| 54 | 54 | */ |
| 55 | - public $query = []; |
|
| 56 | - public $batchWriteItem = []; |
|
| 55 | + public $query = [ ]; |
|
| 56 | + public $batchWriteItem = [ ]; |
|
| 57 | 57 | |
| 58 | 58 | /** @var $dynamodbClient DynamoDbClient */ |
| 59 | 59 | protected $dynamodbClient; |
| 60 | 60 | |
| 61 | 61 | public function __construct(array $config) |
| 62 | 62 | { |
| 63 | - $this->dynamodbClient = new DynamoDbClient($config["S3Config"]); |
|
| 63 | + $this->dynamodbClient = new DynamoDbClient($config[ "S3Config" ]); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function hydrate(array $query) |
@@ -71,20 +71,20 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function setExpressionAttributeName($placeholder, $name) |
| 73 | 73 | { |
| 74 | - $this->query['ExpressionAttributeNames'][$placeholder] = $name; |
|
| 74 | + $this->query[ 'ExpressionAttributeNames' ][ $placeholder ] = $name; |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function setExpressionAttributeValue($placeholder, $value) |
| 79 | 79 | { |
| 80 | - $this->query['ExpressionAttributeValues'][$placeholder] = $value; |
|
| 80 | + $this->query[ 'ExpressionAttributeValues' ][ $placeholder ] = $value; |
|
| 81 | 81 | return $this; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public function setKeyConditionExpression($mapping) |
| 85 | 85 | { |
| 86 | 86 | if ($mapping) { |
| 87 | - $this->query['KeyConditionExpression'] = $mapping; |
|
| 87 | + $this->query[ 'KeyConditionExpression' ] = $mapping; |
|
| 88 | 88 | } |
| 89 | 89 | return $this; |
| 90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function setProjectionExpression($expression) |
| 93 | 93 | { |
| 94 | 94 | if ($expression) { |
| 95 | - $this->query['ProjectionExpression'] = $expression; |
|
| 95 | + $this->query[ 'ProjectionExpression' ] = $expression; |
|
| 96 | 96 | } |
| 97 | 97 | return $this; |
| 98 | 98 | } |
@@ -100,14 +100,14 @@ discard block |
||
| 100 | 100 | public function setExpressionAttributeValues($mapping) |
| 101 | 101 | { |
| 102 | 102 | if ($mapping) { |
| 103 | - $this->query['ExpressionAttributeValues'] = $mapping; |
|
| 103 | + $this->query[ 'ExpressionAttributeValues' ] = $mapping; |
|
| 104 | 104 | } |
| 105 | 105 | return $this; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function setRequestItems($items) |
| 109 | 109 | { |
| 110 | - $this->batchWriteItem['RequestItems'] = $items; |
|
| 110 | + $this->batchWriteItem[ 'RequestItems' ] = $items; |
|
| 111 | 111 | return $this; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | public function __call($method, $parameters) |
| 137 | 137 | { |
| 138 | 138 | if (strpos($method, 'set') === 0) { |
| 139 | - $key = array_reverse(explode('set', $method, 2))[0]; |
|
| 140 | - $this->query[$key] = current($parameters); |
|
| 139 | + $key = array_reverse(explode('set', $method, 2))[ 0 ]; |
|
| 140 | + $this->query[ $key ] = current($parameters); |
|
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | throw new BadMethodCallException(sprintf( |