Simple::setData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EasyDictionary\DataProvider;
6
7
use EasyDictionary\Interfaces\DataProviderFilterInterface;
8
use EasyDictionary\Interfaces\DataProviderInterface;
9
10
/**
11
 * Class Simple
12
 *
13
 * @package EasyDictionary\DataProvider
14
 */
15
class Simple implements DataProviderInterface
16
{
17
    protected $data = [];
18
19
    /**
20
     * @param array $datProviderConfig
21
     */
22 6
    public function __construct($datProviderConfig = [])
23
    {
24 6
        $this->setData($datProviderConfig['items'] ?? []);
25 6
    }
26
27
    /**
28
     * @param DataProviderFilterInterface|null $filter
29
     * @return iterable
30
     */
31 2
    public function getData(DataProviderFilterInterface $filter = null): iterable
32
    {
33 2
        return $this->data;
34
    }
35
36
    /**
37
     * @param iterable $data
38
     *
39
     * @return $this
40
     */
41 6
    public function setData(iterable $data = [])
42
    {
43 6
        $this->data = $data;
44
45 6
        return $this;
46
    }
47
}
48