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

DataCollectionFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 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