Completed
Push — master ( 745336...aadd5d )
by Matthew
06:17
created

CommonTrait::removeOlderThan()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 4
crap 1
1
<?php
2
3
namespace Dtc\QueueBundle\ORM;
4
5
use Doctrine\ORM\EntityManager;
6
7
trait CommonTrait
8
{
9
    /**
10
     * @param \Doctrine\ODM\MongoDB\DocumentManager $documentManager
0 ignored issues
show
Bug introduced by
There is no parameter named $documentManager. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
11
     * @param string                                $objectName
12
     * @param string                                $field
13
     * @param \DateTime                             $olderThan
14
     *
15
     * @return int
16
     */
17 1
    protected function removeOlderThan(EntityManager $entityManager, $objectName, $field, \DateTime $olderThan)
18
    {
19 1
        $qb = $entityManager->createQueryBuilder()->delete($objectName, 'j');
20
        $qb = $qb
21 1
            ->where('j.'.$field.' < :'.$field)
22 1
            ->setParameter(':'.$field, $olderThan);
23
24 1
        $query = $qb->getQuery();
25
26 1
        return $query->execute();
27
    }
28
}
29