1 | <?php |
||
9 | class Driver implements BaseDriver |
||
10 | { |
||
11 | /** |
||
12 | * @var \MongoClient |
||
13 | */ |
||
14 | private $connection; |
||
15 | |||
16 | /** |
||
17 | * @var \MongoDB |
||
18 | */ |
||
19 | private $database; |
||
20 | |||
21 | /** |
||
22 | * Driver constructor. |
||
23 | * @param \MongoClient $connection |
||
24 | * @param string $database |
||
25 | */ |
||
26 | 4 | public function __construct(\MongoClient $connection, $database) |
|
31 | |||
32 | /** |
||
33 | * @return \MongoDB |
||
34 | */ |
||
35 | public function getDatabase() |
||
39 | |||
40 | public function getConnection() |
||
44 | |||
45 | /** |
||
46 | * @param \Iterator $cursor |
||
47 | * @return array |
||
48 | */ |
||
49 | public function fetch(\Iterator $cursor) |
||
54 | |||
55 | /** |
||
56 | * @param array $collection |
||
57 | * @param array $query |
||
58 | * @return \Iterator |
||
59 | */ |
||
60 | public function find($collection, array $query = array()) |
||
64 | |||
65 | /** |
||
66 | * @param Collection $collection |
||
67 | * @return array |
||
68 | */ |
||
69 | 3 | public function generateQuery(Collection $collection) |
|
73 | |||
74 | /** |
||
75 | * @param Collection $collection |
||
76 | * @return array |
||
77 | */ |
||
78 | 3 | protected function parseConditions(Collection $collection) |
|
91 | |||
92 | /** |
||
93 | * @param Collection $collection |
||
94 | * @param bool|false $prefix |
||
95 | * @return array |
||
96 | */ |
||
97 | 3 | protected function getConditionArray(Collection $collection, $prefix = false) |
|
110 | |||
111 | /** |
||
112 | * @param array $array |
||
113 | * @param string $prefix |
||
114 | * @return array |
||
115 | */ |
||
116 | 1 | protected static function prefixArrayKeys(array $array, $prefix) |
|
125 | |||
126 | /** |
||
127 | * @param int|string $id |
||
128 | * @return \MongoId|\MongoInt32 |
||
129 | */ |
||
130 | 2 | protected function createMongoId($id) |
|
137 | |||
138 | /** |
||
139 | * @param Collection $collection |
||
140 | * @param $document |
||
141 | * @return void |
||
142 | */ |
||
143 | public function insert($collection, $document) |
||
147 | |||
148 | public function update($collection, $criteria, $document) |
||
152 | |||
153 | public function remove($collection, $criteria) |
||
157 | } |
||
158 |
Adding braces to control structures avoids accidental mistakes as your code changes: