| Total Complexity | 6 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 85% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | trait CommonTrait |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @param string $objectName |
||
| 16 | * @param string $field |
||
| 17 | * |
||
| 18 | * @return int |
||
| 19 | */ |
||
| 20 | 2 | protected function removeOlderThan($objectName, $field, \DateTime $olderThan) |
|
| 21 | { |
||
| 22 | /** @var DocumentManager $objectManager */ |
||
| 23 | 2 | $objectManager = $this->getObjectManager(); |
|
| 24 | 2 | $qb = $objectManager->createQueryBuilder($objectName); |
|
| 25 | $qb |
||
| 26 | 2 | ->remove() |
|
| 27 | 2 | ->field($field)->lt($olderThan); |
|
| 28 | |||
| 29 | 2 | $query = $qb->getQuery(); |
|
| 30 | 2 | $result = $query->execute(); |
|
| 31 | 2 | if ($result instanceof DeleteResult) { |
|
| 32 | 2 | return $result->getDeletedCount(); |
|
| 33 | } elseif (isset($result['n'])) { |
||
| 34 | return $result['n']; |
||
| 35 | } |
||
| 36 | |||
| 37 | return 0; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param Run|Job|JobTiming $object |
||
| 42 | * @param string $action |
||
| 43 | */ |
||
| 44 | 22 | protected function persist($object, $action = 'persist') |
|
| 49 | 22 | } |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @return ObjectManager |
||
| 53 | */ |
||
| 54 | abstract public function getObjectManager(); |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $objectName |
||
| 58 | */ |
||
| 59 | 1 | public function stopIdGenerator($objectName) |
|
| 60 | { |
||
| 61 | // Not needed for ODM |
||
| 62 | 1 | } |
|
| 63 | |||
| 64 | 1 | public function restoreIdGenerator($objectName) |
|
| 66 | // Not needed for ODM |
||
| 67 | 1 | } |
|
| 68 | } |
||
| 69 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths