| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | namespace Algatux\QueryBuilder; | 
| 4 | 4 | |
| 5 | 5 | use MongoDB\Collection; | 
| 6 | -use MongoDB\Driver\Cursor; | |
| 7 | 6 | |
| 8 | 7 | /** | 
| 9 | 8 | * Class Query | 
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | * @param array $filters | 
| 40 | 40 | * @param array $options | 
| 41 | 41 | */ | 
| 42 | - public function __construct(Collection $collection, int $type=self::TYPE_FIND, array $filters=[], array $options=[]) | |
| 42 | + public function __construct(Collection $collection, int $type = self::TYPE_FIND, array $filters = [ ], array $options = [ ]) | |
| 43 | 43 |      { | 
| 44 | 44 | $this->collection = $collection; | 
| 45 | 45 | $this->filters = $filters; | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | */ | 
| 55 | 55 | protected function execute() | 
| 56 | 56 |      { | 
| 57 | -        switch($this->type) { | |
| 57 | +        switch ($this->type) { | |
| 58 | 58 | case self::TYPE_FIND: | 
| 59 | 59 | return $this->collection->find($this->filters, $this->options); | 
| 60 | 60 | break; | 
| @@ -15,7 +15,7 @@ discard block | ||
| 15 | 15 | */ | 
| 16 | 16 | public function __construct() | 
| 17 | 17 |      { | 
| 18 | - $this->filters = []; | |
| 18 | + $this->filters = [ ]; | |
| 19 | 19 | } | 
| 20 | 20 | |
| 21 | 21 | /** | 
| @@ -27,8 +27,8 @@ discard block | ||
| 27 | 27 |      { | 
| 28 | 28 |          $this->prepareOperator('$and'); | 
| 29 | 29 | |
| 30 | - $this->filters['$and'] = array_merge( | |
| 31 | - $this->filters['$and'], | |
| 30 | + $this->filters[ '$and' ] = array_merge( | |
| 31 | + $this->filters[ '$and' ], | |
| 32 | 32 | $this->mapExpressions(...func_get_args()) | 
| 33 | 33 | ); | 
| 34 | 34 | |
| @@ -44,8 +44,8 @@ discard block | ||
| 44 | 44 |      { | 
| 45 | 45 |          $this->prepareOperator('$or'); | 
| 46 | 46 | |
| 47 | - $this->filters['$or'] = array_merge( | |
| 48 | - $this->filters['$or'], | |
| 47 | + $this->filters[ '$or' ] = array_merge( | |
| 48 | + $this->filters[ '$or' ], | |
| 49 | 49 | $this->mapExpressions(...func_get_args()) | 
| 50 | 50 | ); | 
| 51 | 51 | |
| @@ -65,8 +65,8 @@ discard block | ||
| 65 | 65 | */ | 
| 66 | 66 | private function prepareOperator(string $operator) | 
| 67 | 67 |      { | 
| 68 | -        if (!isset($this->filters[$operator])) { | |
| 69 | - $this->filters[$operator] = []; | |
| 68 | +        if (!isset($this->filters[ $operator ])) { | |
| 69 | + $this->filters[ $operator ] = [ ]; | |
| 70 | 70 | } | 
| 71 | 71 | } | 
| 72 | 72 | |
| @@ -78,7 +78,7 @@ discard block | ||
| 78 | 78 | private function mapExpressions($expressions): array | 
| 79 | 79 |      { | 
| 80 | 80 | return array_map( | 
| 81 | -            function ($expression) { | |
| 81 | +            function($expression) { | |
| 82 | 82 | return $expression instanceof Expression ? $expression->getExpressionFilters() : $expression; | 
| 83 | 83 | }, | 
| 84 | 84 | func_get_args() | 
| @@ -26,7 +26,7 @@ discard block | ||
| 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 | /** | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | */ | 
| 100 | 100 | public function sort(array $fields) | 
| 101 | 101 |      { | 
| 102 | - $this->options['sort'] = $fields; | |
| 102 | + $this->options[ 'sort' ] = $fields; | |
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | /** | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | */ | 
| 108 | 108 | public function setMaxResults(int $limit) | 
| 109 | 109 |      { | 
| 110 | - $this->options['limit'] = $limit; | |
| 110 | + $this->options[ 'limit' ] = $limit; | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | 
| @@ -115,7 +115,7 @@ discard block | ||
| 115 | 115 | */ | 
| 116 | 116 | public function select(array $projection) | 
| 117 | 117 |      { | 
| 118 | - $this->options['projection'] = $projection; | |
| 118 | + $this->options[ 'projection' ] = $projection; | |
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | 121 | /** |