Passed
Push — master ( 9adc1b...ec3431 )
by Pavel
03:44
created

LazyCriteriaCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A doInitialize() 0 4 1
1
<?php
2
3
namespace Bankiru\Api\Doctrine\Proxy;
4
5
use Bankiru\Api\Doctrine\Persister\CollectionPersister;
6
use Doctrine\Common\Collections\AbstractLazyCollection;
7
use Doctrine\Common\Collections\Criteria;
8
9
final class LazyCriteriaCollection extends AbstractLazyCollection
10
{
11
    /**
12
     * @var CollectionPersister
13
     */
14
    private $persister;
15
    /**
16
     * @var Criteria
17
     */
18
    private $criteria;
19
20
    /**
21
     * LazyCriteriaCollection constructor.
22
     *
23
     * @param CollectionPersister $persister
24
     * @param Criteria            $criteria
25
     */
26 1
    public function __construct(CollectionPersister $persister, Criteria $criteria)
27
    {
28 1
        $this->persister = $persister;
29 1
        $this->criteria  = $criteria;
30 1
    }
31
32
    /**
33
     * Do the initialization logic
34
     *
35
     * @return void
36
     */
37 1
    protected function doInitialize()
38
    {
39 1
        $this->collection = $this->persister->matching($this->criteria);
40 1
    }
41
}
42