@@ -46,7 +46,7 @@ |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @return mixed |
|
| 49 | + * @return \MongoDB\Driver\Cursor|null |
|
| 50 | 50 | * |
| 51 | 51 | * @throws \Exception |
| 52 | 52 | */ |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @param array $query |
| 38 | 38 | * @param array $options |
| 39 | 39 | */ |
| 40 | - public function __construct(Collection $collection, array $query = [], array $options = []) |
|
| 40 | + public function __construct(Collection $collection, array $query = [ ], array $options = [ ]) |
|
| 41 | 41 | { |
| 42 | 42 | $this->collection = $collection; |
| 43 | 43 | $this->query = $query; |
| 44 | 44 | $this->options = $options; |
| 45 | - $this->type = $query['type'] ?? self::TYPE_FIND; |
|
| 45 | + $this->type = $query[ 'type' ] ?? self::TYPE_FIND; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function execute() |
| 54 | 54 | { |
| 55 | - switch($this->type) { |
|
| 55 | + switch ($this->type) { |
|
| 56 | 56 | case self::TYPE_FIND: |
| 57 | 57 | return $this->collection->find($this->query, $this->options); |
| 58 | 58 | break; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct() |
| 17 | 17 | { |
| 18 | - $this->queryPartial = []; |
|
| 18 | + $this->queryPartial = [ ]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->prepareOperator('$and'); |
| 29 | 29 | |
| 30 | - $this->queryPartial['$and'] = array_merge( |
|
| 31 | - $this->queryPartial['$and'], |
|
| 30 | + $this->queryPartial[ '$and' ] = array_merge( |
|
| 31 | + $this->queryPartial[ '$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->queryPartial['$or'] = array_merge( |
|
| 48 | - $this->queryPartial['$or'], |
|
| 47 | + $this->queryPartial[ '$or' ] = array_merge( |
|
| 48 | + $this->queryPartial[ '$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->queryPartial[$operator])) { |
|
| 69 | - $this->queryPartial[$operator] = []; |
|
| 68 | + if (!isset($this->queryPartial[ $operator ])) { |
|
| 69 | + $this->queryPartial[ $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->getQueryPartial() : $expression; |
| 83 | 83 | }, |
| 84 | 84 | func_get_args() |