Passed
Pull Request — 3.x (#201)
by Giso
02:52
created

TransactionCondition   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A apply() 0 6 2
A __construct() 0 3 1
1
<?php
2
3
namespace DH\DoctrineAuditBundle\Reader;
4
5
use Doctrine\DBAL\Query\QueryBuilder;
6
7
class TransactionCondition implements ConditionInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $transactionHash;
13
14
    /**
15
     * Apply transaction filtering
16
     *
17
     * @param array $types
18
     */
19
    public function __construct($transactionHash)
20
    {
21
        $this->transactionHash = $transactionHash;
22
    }
23
24
    public function apply(QueryBuilder $queryBuilder)
25
    {
26
        if (null !== $this->transactionHash) {
27
            $queryBuilder
28
                ->andWhere('transaction_hash = :transaction_hash')
29
                ->setParameter('transaction_hash', $this->transactionHash)
30
            ;
31
        }
32
    }
33
}
34