@@ -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,10 +27,10 @@ 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 | array_map( |
| 33 | - function ($expression) { |
|
| 33 | + function($expression) { |
|
| 34 | 34 | return $expression instanceof Expression ? $expression->getQueryPartial() : $expression; |
| 35 | 35 | }, |
| 36 | 36 | func_get_args() |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $this->prepareOperator('$or'); |
| 51 | 51 | |
| 52 | - $this->queryPartial['$or'] = array_merge( |
|
| 53 | - $this->queryPartial['$or'], |
|
| 52 | + $this->queryPartial[ '$or' ] = array_merge( |
|
| 53 | + $this->queryPartial[ '$or' ], |
|
| 54 | 54 | array_map( |
| 55 | - function ($expression) { |
|
| 55 | + function($expression) { |
|
| 56 | 56 | return $expression instanceof Expression ? $expression->getQueryPartial() : $expression; |
| 57 | 57 | }, |
| 58 | 58 | func_get_args() |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private function prepareOperator(string $operator) |
| 77 | 77 | { |
| 78 | - if (!isset($this->queryPartial[$operator])) { |
|
| 79 | - $this->queryPartial[$operator] = []; |
|
| 78 | + if (!isset($this->queryPartial[ $operator ])) { |
|
| 79 | + $this->queryPartial[ $operator ] = [ ]; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |