Completed
Push — master ( ff3d5b...77ffdb )
by hook
06:35
created
work2.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 
10
-class Table{
10
+class Table {
11 11
     public function getuser()
12 12
     {
13 13
         return "ok";
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
         echo "class find\r\n";
21 21
 
22 22
         $t1 = microtime(true);
23
-        foreach (range(1,500) as $a){
23
+        foreach (range(1, 500) as $a) {
24 24
             $func = "get".$field;
25
-            if (method_exists($this,$func)) {
26
-                call_user_func([$this,$func]);
25
+            if (method_exists($this, $func)) {
26
+                call_user_func([ $this, $func ]);
27 27
             }
28 28
         }
29 29
 
30
-        var_dump(microtime(true)-$t1);
30
+        var_dump(microtime(true) - $t1);
31 31
 
32 32
 
33 33
 
34 34
         echo "array find\r\n";
35 35
         $t1 = microtime(true);
36
-        foreach (range(1,500) as $a) {
37
-            $a = ['set.user' => 'getuser', 'get.user' => 'getuser'];
38
-            $func = 'set.' . $field;
36
+        foreach (range(1, 500) as $a) {
37
+            $a = [ 'set.user' => 'getuser', 'get.user' => 'getuser' ];
38
+            $func = 'set.'.$field;
39 39
 //            if (isset($a[$func])) {
40
-                call_user_func([$this, $a[$func]]);
40
+                call_user_func([ $this, $a[ $func ] ]);
41 41
 //            }
42 42
         }
43
-        var_dump(microtime(true)-$t1);
43
+        var_dump(microtime(true) - $t1);
44 44
     }
45 45
 }
46 46
 
Please login to merge, or discard this patch.
src/Grammars/DynamoDBGrammar.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
         return $this->limit;
31 31
     }
32 32
     
33
-     /**
34
-     * Get the grammar specific operators.
35
-     *
36
-     * @return array
37
-     */
33
+        /**
34
+         * Get the grammar specific operators.
35
+         *
36
+         * @return array
37
+         */
38 38
     public function getOperators()
39 39
     {
40 40
         return $this->operators;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Hoooklife\DynamodbPodm\Grammars;
3
-class DynamoDBGrammar{
4
-    protected $operators = [];
3
+class DynamoDBGrammar {
4
+    protected $operators = [ ];
5 5
 
6
-    protected $params = [];
6
+    protected $params = [ ];
7 7
 
8 8
     // 表达式解析 where
9
-    public function parseKeyConditionExpression(){
10
-        $expression = [];
9
+    public function parseKeyConditionExpression() {
10
+        $expression = [ ];
11 11
         foreach ($this->wheres as $where) {
12
-            $expression[] = "{$where['column']} {$where['operator']} {$where['value']}";
12
+            $expression[ ] = "{$where[ 'column' ]} {$where[ 'operator' ]} {$where[ 'value' ]}";
13 13
         }
14 14
 
15 15
         return implode("and", $expression);
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
     // select
20 20
     public function parseProjectionExpression()
21 21
     {
22
-        if( reset($this->columns) != '*'  ){
22
+        if (reset($this->columns) != '*') {
23 23
             return implode(",", $this->columns);
24 24
         }
25 25
         return null;
26 26
     }
27 27
 
28 28
     // limit
29
-    public function parseLimit(){
29
+    public function parseLimit() {
30 30
         return $this->limit;
31 31
     }
32 32
     
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 namespace Hoooklife\DynamodbPodm;
3 3
 use Hoooklife\DynamodbPodm\Query\Builder;
4 4
 class DB {
5
-    public static $config = [];
5
+    public static $config = [ ];
6 6
 
7 7
     public static function config(array $config)
8 8
     {
Please login to merge, or discard this patch.
src/Query/DynamoDBBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
  * @method QueryBuilder setLimit(int $limit)
48 48
  * @method QueryBuilder setKey(array $key)
49 49
  */
50
-class DynamoDBBuilder{
50
+class DynamoDBBuilder {
51 51
     /**
52 52
      * Query body to be sent to AWS
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Query/Builder.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         switch (DB::$config[$connection]['driver']) {
27 27
             case "dynamedb":
28 28
                $this->grammar = new DynamoDBGrammar();
29
-               break;
29
+                break;
30 30
             default:
31 31
                 throw new Exception("bad driver");
32 32
         }        
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         if (is_array($column)) {
90 90
             // 递归
91 91
             foreach ($column as $key => $value) {
92
-                 if (is_numeric($key) && is_array($value)) {
92
+                    if (is_numeric($key) && is_array($value)) {
93 93
                     $this->where(...array_values($value));
94 94
                 } else {
95 95
                     $this->where($key, '=', $value, $boolean);
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
     }
128 128
 
129 129
 
130
-     /**
131
-     * Determine if the given operator is supported.
132
-     *
133
-     * @param  string  $operator
134
-     * @return bool
135
-     */
130
+        /**
131
+         * Determine if the given operator is supported.
132
+         *
133
+         * @param  string  $operator
134
+         * @return bool
135
+         */
136 136
     protected function invalidOperator($operator)
137 137
     {
138 138
         return ! in_array(strtolower($operator), $this->operators, true) &&
@@ -199,24 +199,24 @@  discard block
 block discarded – undo
199 199
         return $this;
200 200
     }
201 201
 
202
-     /**
203
-     * Set the limit and offset for a given page.
204
-     *
205
-     * @param  int  $page
206
-     * @param  int  $perPage
207
-     * @return \Illuminate\Database\Query\Builder|static
208
-     */
202
+        /**
203
+         * Set the limit and offset for a given page.
204
+         *
205
+         * @param  int  $page
206
+         * @param  int  $perPage
207
+         * @return \Illuminate\Database\Query\Builder|static
208
+         */
209 209
     public function forPage($page, $perPage = 15)
210 210
     {
211 211
         return $this->skip(($page - 1) * $perPage)->take($perPage);
212 212
     }
213 213
 
214 214
 
215
-     /**
216
-     * Get the SQL representation of the query.
217
-     *
218
-     * @return string
219
-     */
215
+        /**
216
+         * Get the SQL representation of the query.
217
+         *
218
+         * @return string
219
+         */
220 220
     public function toSql()
221 221
     {
222 222
         return $this->grammar->compileSelect($this);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 namespace Hoooklife\DynamodbPodm\Query;
4 4
 use Hoooklife\DynamodbPodm\DB;
5 5
 use Hoooklife\DynamodbPodm\Grammars\DynamoDBGrammar;
6
-class Builder{
6
+class Builder {
7 7
 
8 8
     /**
9 9
      * 查询排序
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function __construct($connection = 'default')
25 25
     {
26
-        switch (DB::$config[$connection]['driver']) {
26
+        switch (DB::$config[ $connection ][ 'driver' ]) {
27 27
             case "dynamedb":
28 28
                $this->grammar = new DynamoDBGrammar();
29 29
                break;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @param  array|mixed  $columns
40 40
      * @return $this
41 41
      */
42
-    public function select($columns = ['*'])
42
+    public function select($columns = [ '*' ])
43 43
     {
44 44
         $this->columns = is_array($columns) ? $columns : func_get_args();
45 45
         return $this;
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
             // return $this->addArrayOfWheres($column, $boolean);
100 100
         }
101 101
 
102
-        if(func_num_args() === 2 || $this->invalidOperator($operator)) {
103
-            list($value, $operator) = [$operator, '='];
102
+        if (func_num_args() === 2 || $this->invalidOperator($operator)) {
103
+            list($value, $operator) = [ $operator, '=' ];
104 104
         }
105 105
 
106 106
         // where in
107
-        if (is_array($value)){
108
-            return $this->whereIn($column,$boolean);
107
+        if (is_array($value)) {
108
+            return $this->whereIn($column, $boolean);
109 109
         }
110 110
 
111 111
         // is null
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 
117 117
         $type = 'Basic';
118
-        $this->wheres[] = compact(
118
+        $this->wheres[ ] = compact(
119 119
             'type', 'column', 'operator', 'value', 'boolean'
120 120
         );
121 121
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
      */
136 136
     protected function invalidOperator($operator)
137 137
     {
138
-        return ! in_array(strtolower($operator), $this->operators, true) &&
139
-               ! in_array(strtolower($operator), $this->grammar->getOperators(), true);
138
+        return !in_array(strtolower($operator), $this->operators, true) &&
139
+               !in_array(strtolower($operator), $this->grammar->getOperators(), true);
140 140
     }
141 141
 
142 142
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function value($column)
233 233
     {
234
-        $result = (array) $this->first([$column]);
234
+        $result = (array) $this->first([ $column ]);
235 235
         return count($result) > 0 ? reset($result) : null;
236 236
     }
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * @param  array  $columns
244 244
      * @return \Illuminate\Database\Eloquent\Model|object|static|null
245 245
      */
246
-    public function first($columns = ['*'])
246
+    public function first($columns = [ '*' ])
247 247
     {
248 248
         return reset($this->take(1)->all($columns));
249 249
     }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      * @param  array  $columns
256 256
      * @return \Illuminate\Support\Collection
257 257
      */
258
-    public function all($columns = ['*'])
258
+    public function all($columns = [ '*' ])
259 259
     {
260 260
         return $this->grammar->all();
261 261
     }
Please login to merge, or discard this patch.