RunManager   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 91.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 25
ccs 11
cts 12
cp 0.9167
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getOldLiveRuns() 0 16 2
1
<?php
2
3
namespace Dtc\QueueBundle\ODM;
4
5
use Doctrine\MongoDB\Query\Builder;
0 ignored issues
show
Bug introduced by
The type Doctrine\MongoDB\Query\Builder was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Doctrine\ODM\MongoDB\DocumentManager;
0 ignored issues
show
Bug introduced by
The type Doctrine\ODM\MongoDB\DocumentManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Dtc\QueueBundle\Doctrine\DoctrineRunManager;
8
9
class RunManager extends DoctrineRunManager
10
{
11 1
    use CommonTrait;
12
13
    /**
14
     * @return array
15
     *
16
     * @throws \Exception
17
     */
18 1
    protected function getOldLiveRuns()
19
    {
20
        /** @var DocumentManager $objectManager */
21 1
        $objectManager = $this->getObjectManager();
22
        /** @var Builder $queryBuilder */
23 1
        $queryBuilder = $objectManager->createQueryBuilder($this->getRunClass());
24 1
        $queryBuilder->find();
25 1
        $time = time() - 86400;
26 1
        $date = \DateTime::createFromFormat('U', strval($time));
27 1
        if (false === $date) {
28
            throw new \Exception("Could not create DateTime object from $time");
29
        }
30 1
        $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));
31 1
        $queryBuilder->field('lastHeartbeatAt')->lt($date);
32
33 1
        return $queryBuilder->getQuery()->toArray();
34
    }
35
}
36