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

CommonTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A removeOlderThan() 0 11 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