1 | <?php declare(strict_types = 1); |
||
10 | class Query |
||
11 | { |
||
12 | const TYPE_FIND = 1; |
||
13 | const TYPE_FIND_AND_UPDATE = 2; |
||
14 | const TYPE_FIND_AND_REMOVE = 3; |
||
15 | const TYPE_INSERT = 4; |
||
16 | const TYPE_UPDATE = 5; |
||
17 | const TYPE_REMOVE = 6; |
||
18 | const TYPE_GROUP = 7; |
||
19 | const TYPE_MAP_REDUCE = 8; |
||
20 | const TYPE_DISTINCT = 9; |
||
21 | const TYPE_GEO_NEAR = 10; |
||
22 | const TYPE_COUNT = 11; |
||
23 | |||
24 | /** @var Collection */ |
||
25 | private $collection; |
||
26 | /** @var array */ |
||
27 | private $query; |
||
28 | /** @var array */ |
||
29 | private $options; |
||
30 | /** @var int */ |
||
31 | private $type; |
||
32 | |||
33 | /** |
||
34 | * Query constructor. |
||
35 | * |
||
36 | * @param Collection $collection |
||
37 | * @param array $query |
||
38 | * @param array $options |
||
39 | */ |
||
40 | public function __construct(Collection $collection, array $query = [], array $options = []) |
||
47 | |||
48 | /** |
||
49 | * @return mixed |
||
50 | * |
||
51 | * @throws \Exception |
||
52 | */ |
||
53 | public function execute() |
||
63 | |||
64 | /** |
||
65 | * @return array |
||
66 | */ |
||
67 | public function getQuery(): array |
||
71 | |||
72 | /** |
||
73 | * @return array |
||
74 | */ |
||
75 | public function getOptions(): array |
||
79 | } |
||
80 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.