@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function __construct($connection = 'default') |
| 30 | 30 | { |
| 31 | - switch (DB::$config[$connection]['driver']) { |
|
| 31 | + switch (DB::$config[ $connection ][ 'driver' ]) { |
|
| 32 | 32 | case "dynamedb": |
| 33 | - $this->grammar = new DynamoDBGrammar($this, DB::$config[$connection]); |
|
| 33 | + $this->grammar = new DynamoDBGrammar($this, DB::$config[ $connection ]); |
|
| 34 | 34 | break; |
| 35 | 35 | default: |
| 36 | 36 | throw new Exception("bad driver"); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param array|mixed $columns |
| 45 | 45 | * @return $this |
| 46 | 46 | */ |
| 47 | - public function select($columns = ['*']) |
|
| 47 | + public function select($columns = [ '*' ]) |
|
| 48 | 48 | { |
| 49 | 49 | $this->columns = is_array($columns) ? $columns : func_get_args(); |
| 50 | 50 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function addSelect($columns) |
| 61 | 61 | { |
| 62 | 62 | $columns = is_array($columns) ? $columns : func_get_args(); |
| 63 | - $this->columns = array_merge((array)$this->columns, $columns); |
|
| 63 | + $this->columns = array_merge((array) $this->columns, $columns); |
|
| 64 | 64 | return $this; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if (func_num_args() === 2 || $this->invalidOperator($operator)) { |
| 107 | - list($value, $operator) = [$operator, '=']; |
|
| 107 | + list($value, $operator) = [ $operator, '=' ]; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // where in |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | $type = 'Basic'; |
| 122 | - $this->wheres[] = compact( |
|
| 122 | + $this->wheres[ ] = compact( |
|
| 123 | 123 | 'type', 'column', 'operator', 'value', 'boolean' |
| 124 | 124 | ); |
| 125 | 125 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function value($column) |
| 237 | 237 | { |
| 238 | - $result = (array)$this->first([$column]); |
|
| 238 | + $result = (array) $this->first([ $column ]); |
|
| 239 | 239 | return count($result) > 0 ? reset($result) : null; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @param array $columns |
| 247 | 247 | * @return \Illuminate\Database\Eloquent\Model|object|static|null |
| 248 | 248 | */ |
| 249 | - public function first($columns = ['*']) |
|
| 249 | + public function first($columns = [ '*' ]) |
|
| 250 | 250 | { |
| 251 | 251 | return reset($this->take(1)->all($columns)); |
| 252 | 252 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param array $columns |
| 259 | 259 | * @return void |
| 260 | 260 | */ |
| 261 | - public function all($columns = ['*']) |
|
| 261 | + public function all($columns = [ '*' ]) |
|
| 262 | 262 | { |
| 263 | 263 | return $this->grammar->all(); |
| 264 | 264 | } |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class DynamoDBGrammar |
| 11 | 11 | { |
| 12 | - protected $operators = []; |
|
| 12 | + protected $operators = [ ]; |
|
| 13 | 13 | |
| 14 | - protected $params = []; |
|
| 14 | + protected $params = [ ]; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var Builder |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | // 表达式解析 where |
| 41 | 41 | public function parseKeyConditionExpression() |
| 42 | 42 | { |
| 43 | - $expression = []; |
|
| 43 | + $expression = [ ]; |
|
| 44 | 44 | foreach ($this->builder->wheres as $where) { |
| 45 | - $expression[] = "{$where['column']} {$where['operator']} {$where['value']}"; |
|
| 45 | + $expression[ ] = "{$where[ 'column' ]} {$where[ 'operator' ]} {$where[ 'value' ]}"; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | return implode("and", $expression); |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @var array |
| 58 | 58 | */ |
| 59 | - public $query = []; |
|
| 59 | + public $query = [ ]; |
|
| 60 | 60 | |
| 61 | 61 | protected $dynamodbClient; |
| 62 | 62 | |
| 63 | 63 | public function __construct(array $config) |
| 64 | 64 | { |
| 65 | - $this->dynamodbClient = new DynamoDbClient($config["S3Config"]); |
|
| 65 | + $this->dynamodbClient = new DynamoDbClient($config[ "S3Config" ]); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function hydrate(array $query) |
@@ -72,12 +72,12 @@ 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 | 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 | |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | public function __call($method, $parameters) |
| 101 | 101 | { |
| 102 | 102 | if (strpos($method, 'set') === 0) { |
| 103 | - $key = array_reverse(explode('set', $method, 2))[0]; |
|
| 104 | - $this->query[$key] = current($parameters); |
|
| 103 | + $key = array_reverse(explode('set', $method, 2))[ 0 ]; |
|
| 104 | + $this->query[ $key ] = current($parameters); |
|
| 105 | 105 | return $this; |
| 106 | 106 | } |
| 107 | 107 | throw new BadMethodCallException(sprintf( |