Completed
Push — master ( c34cac...3c68a7 )
by Pieter
04:47
created

MockPlugin::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace W2w\Lib\Apie\Plugins\Mock;
4
5
use W2w\Lib\Apie\Interfaces\ApiResourceFactoryInterface;
6
use W2w\Lib\Apie\PluginInterfaces\ApieAwareInterface;
7
use W2w\Lib\Apie\PluginInterfaces\ApieAwareTrait;
8
use W2w\Lib\Apie\PluginInterfaces\ApiResourceFactoryProviderInterface;
9
use W2w\Lib\Apie\Plugins\Mock\DataLayers\MockApiResourceDataLayer;
10
use W2w\Lib\Apie\Plugins\Mock\ResourceFactories\MockApiResourceFactory;
11
12
final class MockPlugin implements ApiResourceFactoryProviderInterface, ApieAwareInterface
13
{
14
    use ApieAwareTrait;
15
16
    private $ignoreList = [];
17
18
    public function __construct(array $ignoreList = [])
19
    {
20
        $this->ignoreList = $ignoreList;
21
    }
22
23
    public function getApiResourceFactory(array $next = []): ApiResourceFactoryInterface
24
    {
25
        $apie = $this->getApie();
26
27
        return new MockApiResourceFactory(
28
            new MockApiResourceDataLayer(
29
                $this->getApie()->getCacheItemPool(),
30
                $this->getApie()->getIdentifierExtractor(),
31
                $this->getApie()->getPropertyAccessor()
32
            ),
33
            $apie,
34
            $this->ignoreList
35
        );
36
    }
37
}
38