Total Complexity | 6 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 90% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait CommonTrait |
||
12 | { |
||
13 | /** |
||
14 | * @param string $objectName |
||
15 | * @param string $field |
||
16 | * |
||
17 | * @return int |
||
18 | */ |
||
19 | 2 | protected function removeOlderThan($objectName, $field, \DateTime $olderThan) |
|
20 | { |
||
21 | /** @var DocumentManager $objectManager */ |
||
22 | 2 | $objectManager = $this->getObjectManager(); |
|
23 | 2 | $qb = $objectManager->createQueryBuilder($objectName); |
|
24 | $qb |
||
25 | 2 | ->remove() |
|
26 | 2 | ->field($field)->lt($olderThan); |
|
27 | |||
28 | 2 | $query = $qb->getQuery(); |
|
29 | 2 | $result = $query->execute(); |
|
30 | 2 | if ($result instanceof DeleteResult) { |
|
31 | return $result->getDeletedCount(); |
||
32 | 2 | } elseif (isset($result['n'])) { |
|
33 | 2 | return $result['n']; |
|
34 | } |
||
35 | |||
36 | return 0; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param Run|Job|JobTiming $object |
||
41 | * @param string $action |
||
42 | */ |
||
43 | 22 | protected function persist($object, $action = 'persist') |
|
48 | 22 | } |
|
49 | |||
50 | /** |
||
51 | * @return ObjectManager |
||
52 | */ |
||
53 | abstract public function getObjectManager(); |
||
54 | |||
55 | /** |
||
56 | * @param string $objectName |
||
57 | */ |
||
58 | 1 | public function stopIdGenerator($objectName) |
|
59 | { |
||
60 | // Not needed for ODM |
||
61 | 1 | } |
|
62 | |||
63 | 1 | public function restoreIdGenerator($objectName) |
|
65 | // Not needed for ODM |
||
66 | 1 | } |
|
67 | } |
||
68 |
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