| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function getData(AnalyticModel $schema) |
||
| 40 | { |
||
| 41 | $conn = $this->documentManager->getConnection(); |
||
| 42 | $db = $this->documentManager->getConfiguration()->getDefaultDB(); |
||
| 43 | $collection = $conn->selectCollection($db, $schema->getCollection()); |
||
| 44 | |||
| 45 | $pipeline = $schema->getPipeline(); |
||
| 46 | $data = $collection->aggregate($pipeline)->toArray(); |
||
| 47 | if ('object' === $schema->getType()) { |
||
| 48 | return array_key_exists(0, $data) ? $data[0] : new \stdClass(); |
||
| 49 | } |
||
| 50 | return $data; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |