Simple   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 3 1
A __construct() 0 3 1
A setData() 0 5 1
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