Completed
Push — dev ( 845ef5...8eacd8 )
by
unknown
02:50
created

DataCollectionFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 32
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 create() 0 6 1
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Gui\Grid;
4
5
use eXpansion\Framework\Core\Model\Data\FilterInterface;
6
7
8
/**
9
 * Class DataCollectionFactory
10
 *
11
 * @package eXpansion\Framework\Core\Model\Gui\Grid;
12
 * @author  oliver de Cramer <[email protected]>
13
 */
14
class DataCollectionFactory
15
{
16
    /** @var FilterInterface  */
17
    protected $filterHelper;
18
19
    /** @var string  */
20
    protected $collectionClass;
21
22
    /**
23
     * DataCollectionFactory constructor.
24
     *
25
     * @param FilterInterface $filterHelper
26
     * @param string $collectionClass
27
     */
28 6
    public function __construct(FilterInterface $filterHelper, $collectionClass)
29
    {
30 6
        $this->filterHelper = $filterHelper;
31 6
        $this->collectionClass = $collectionClass;
32 6
    }
33
34
    /**
35
     * @param $data
36
     *
37
     * @return DataCollectionInterface
38
     */
39 6
    public function create($data)
40
    {
41 6
        $class = $this->collectionClass;
42
43 6
        return new $class($data, $this->filterHelper);
44
    }
45
}
46