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