Completed
Pull Request — master (#15)
by Wachter
08:18 queued 05:27
created

TaskRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 1 Features 2
Metric Value
wmc 1
c 6
b 1
f 2
lcom 0
cbo 2
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A findEndBefore() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of php-task library.
5
 *
6
 * (c) php-task
7
 *
8
 * This source file is subject to the MIT license that is bundled
9 6
 * with this source code in the file LICENSE.
10
 */
11 6
12 6
namespace Task\TaskBundle\Entity;
13 6
14 6
use Doctrine\ORM\EntityRepository;
15 6
use Task\TaskInterface;
16 6
17
/**
18 6
 * Repository for task.
19
 */
20
class TaskRepository extends EntityRepository
21
{
22
    /**
23
     * Returns task where last-execution is before given date-time.
24
     *
25
     * @param \DateTime $dateTime
26 3
     *
27
     * @return TaskInterface[]
28 3
     */
29 3
    public function findEndBefore(\DateTime $dateTime)
30 3
    {
31 3
        return $this->createQueryBuilder('t')
32
            ->where('t.lastExecution IS NULL OR t.lastExecution >= :dateTime')
33 3
            ->setParameter('dateTime', $dateTime)
34
            ->getQuery()
35
            ->getResult();
36 6
    }
37
}
38