@@ -28,8 +28,8 @@ discard block |
||
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 |
||
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 |
@@ -54,11 +54,11 @@ |
||
54 | 54 | return $this->builder->limit; |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Get the grammar specific operators. |
|
59 | - * |
|
60 | - * @return array |
|
61 | - */ |
|
57 | + /** |
|
58 | + * Get the grammar specific operators. |
|
59 | + * |
|
60 | + * @return array |
|
61 | + */ |
|
62 | 62 | public function getOperators() |
63 | 63 | { |
64 | 64 | return $this->operators; |
@@ -5,9 +5,9 @@ discard block |
||
5 | 5 | use Hoooklife\DynamodbPodm\Query\Builder; |
6 | 6 | |
7 | 7 | class DynamoDBGrammar { |
8 | - protected $operators = []; |
|
8 | + protected $operators = [ ]; |
|
9 | 9 | |
10 | - protected $params = []; |
|
10 | + protected $params = [ ]; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @var Builder |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | // 葨达εΌθ§£ζ where |
33 | - public function parseKeyConditionExpression(){ |
|
34 | - $expression = []; |
|
33 | + public function parseKeyConditionExpression() { |
|
34 | + $expression = [ ]; |
|
35 | 35 | foreach ($this->builder->wheres as $where) { |
36 | - $expression[] = "{$where['column']} {$where['operator']} {$where['value']}"; |
|
36 | + $expression[ ] = "{$where[ 'column' ]} {$where[ 'operator' ]} {$where[ 'value' ]}"; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return implode("and", $expression); |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | // select |
44 | 44 | public function parseProjectionExpression() |
45 | 45 | { |
46 | - if( reset($this->builder->columns) != '*' ){ |
|
46 | + if (reset($this->builder->columns) != '*') { |
|
47 | 47 | return implode(",", $this->columns); |
48 | 48 | } |
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | |
52 | 52 | // limit |
53 | - public function parseLimit(){ |
|
53 | + public function parseLimit() { |
|
54 | 54 | return $this->builder->limit; |
55 | 55 | } |
56 | 56 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function all() |
68 | 68 | { |
69 | - $dynamodb = new \Aws\DynamoDb\DynamoDbClient($this->config["S3Config"]); |
|
69 | + $dynamodb = new \Aws\DynamoDb\DynamoDbClient($this->config[ "S3Config" ]); |
|
70 | 70 | |
71 | 71 | // var_dump((new Marshaler())->marshalItem([ |
72 | 72 | // ':title'=>'aaa' |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - public $query = []; |
|
56 | + public $query = [ ]; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @param string $method |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | public function __call($method, $parameters) |
64 | 64 | { |
65 | 65 | if (starts_with($method, 'set')) { |
66 | - $key = array_reverse(explode('set', $method, 2))[0]; |
|
67 | - $this->query[$key] = current($parameters); |
|
66 | + $key = array_reverse(explode('set', $method, 2))[ 0 ]; |
|
67 | + $this->query[ $key ] = current($parameters); |
|
68 | 68 | return $this; |
69 | 69 | } |
70 | 70 | throw new BadMethodCallException(sprintf( |
@@ -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 | } |