Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function __construct($collectionOrUrl, string $db = null, string $collection = null) |
||
29 | { |
||
30 | if ($collectionOrUrl instanceof \MongoDB\Collection) { |
||
31 | $this->collection = $collectionOrUrl; |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | if (!is_string($collectionOrUrl)) { |
||
|
|||
36 | throw new \InvalidArgumentException('$collectionOrUrl was not a string'); |
||
37 | } |
||
38 | |||
39 | $this->collection = (new Client($collectionOrUrl))->selectDatabase($db)->selectCollection($collection); |
||
40 | } |
||
42 |