Completed
Push — master ( 57e6ad...7ec29e )
by Alessandro
02:24
created
src/Query.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function __construct(
35 35
         Collection $collection,
36
-        int $type=self::TYPE_FIND,
37
-        array $querySettings=[],
38
-        array $options=[]
36
+        int $type = self::TYPE_FIND,
37
+        array $querySettings = [ ],
38
+        array $options = [ ]
39 39
     ) {
40 40
         $this->collection = $collection;
41 41
         $this->querySettings = $querySettings;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function execute()
52 52
     {
53
-        switch($this->type) {
53
+        switch ($this->type) {
54 54
             case self::TYPE_FIND:
55 55
                     return $this->collection->find($this->querySettings, $this->options);
56 56
                 break;
Please login to merge, or discard this patch.
src/QueryBuilder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $this->collection = $collection;
27 27
         $this->queryType = Query::TYPE_FIND;
28 28
         $this->expression = new Expression();
29
-        $this->options = [];
29
+        $this->options = [ ];
30 30
     }
31 31
 
32 32
     /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $this->setQueryOption('projection', array_fill_keys($projection, 1));
143 143
 
144 144
         if (!in_array('_id', $projection)) {
145
-            $this->options['projection']['_id'] = -1;
145
+            $this->options[ 'projection' ][ '_id' ] = -1;
146 146
         }
147 147
 
148 148
         return $this;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function setQueryOption(string $option, $value)
158 158
     {
159
-        $this->options[$option] = $value;
159
+        $this->options[ $option ] = $value;
160 160
 
161 161
         return $this;
162 162
     }
Please login to merge, or discard this patch.
src/Expression.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function __construct()
17 17
     {
18
-        $this->filters = [];
18
+        $this->filters = [ ];
19 19
     }
20 20
 
21 21
     /**
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $this->prepareFilterIndex('$and');
31 31
 
32
-        $this->filters['$and'] = array_merge(
33
-            $this->filters['$and'],
32
+        $this->filters[ '$and' ] = array_merge(
33
+            $this->filters[ '$and' ],
34 34
             $this->mapExpressions(...func_get_args())
35 35
         );
36 36
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
      */
43 43
     private function prepareFilterIndex(string $operator)
44 44
     {
45
-        if (!isset($this->filters[$operator])) {
46
-            $this->filters[$operator] = [];
45
+        if (!isset($this->filters[ $operator ])) {
46
+            $this->filters[ $operator ] = [ ];
47 47
         }
48 48
     }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     private function mapExpressions($expressions): array
56 56
     {
57 57
         return array_map(
58
-            function ($expression) {
58
+            function($expression) {
59 59
                 return $expression instanceof Expression ? $expression->getExpressionFilters() : $expression;
60 60
             },
61 61
             func_get_args()
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $this->prepareFilterIndex('$or');
85 85
 
86
-        $this->filters['$or'] = array_merge(
87
-            $this->filters['$or'],
86
+        $this->filters[ '$or' ] = array_merge(
87
+            $this->filters[ '$or' ],
88 88
             $this->mapExpressions(...func_get_args())
89 89
         );
90 90
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $this->prepareFilterIndex($field);
105 105
 
106
-        $this->filters[$field] = $this->operationExpression('$eq', $value);
106
+        $this->filters[ $field ] = $this->operationExpression('$eq', $value);
107 107
 
108 108
         return $this;
109 109
     }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $this->prepareFilterIndex($field);
122 122
 
123
-        $this->filters[$field] = $this->operationExpression('$ne', $value);
123
+        $this->filters[ $field ] = $this->operationExpression('$ne', $value);
124 124
 
125 125
         return $this;
126 126
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $this->prepareFilterIndex($field);
139 139
 
140
-        $this->filters[$field] = $this->operationExpression('$in', $values);
140
+        $this->filters[ $field ] = $this->operationExpression('$in', $values);
141 141
 
142 142
         return $this;
143 143
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $this->prepareFilterIndex($field);
156 156
 
157
-        $this->filters[$field] = $this->operationExpression('$nin', $values);
157
+        $this->filters[ $field ] = $this->operationExpression('$nin', $values);
158 158
 
159 159
         return $this;
160 160
     }
@@ -168,6 +168,6 @@  discard block
 block discarded – undo
168 168
      */
169 169
     private function operationExpression(string $operation, $value): array
170 170
     {
171
-        return [$operation => $value];
171
+        return [ $operation => $value ];
172 172
     }
173 173
 }
Please login to merge, or discard this patch.