Loader   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 12
c 1
b 0
f 0
dl 0
loc 33
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A clearCache() 0 3 1
A __construct() 0 3 1
A instantiateFixtures() 0 10 2
A getCache() 0 3 1
1
<?php
2
3
namespace Knp\FriendlyContexts\Alice\Fixtures\Alice2;
4
5
use Knp\FriendlyContexts\Alice\Fixtures\Loader as LoaderInterface;
6
use Knp\FriendlyContexts\Alice\ProviderResolver;
7
use Nelmio\Alice\Fixtures\Loader as BaseLoader;
0 ignored issues
show
Bug introduced by
The type Nelmio\Alice\Fixtures\Loader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
class Loader extends BaseLoader implements
10
    LoaderInterface
11
{
12
    private $cache = [];
13
14
    public function __construct($locale, ProviderResolver $providers)
15
    {
16
        parent::__construct($locale, $providers->all());
17
    }
18
19
    public function getCache()
20
    {
21
        return $this->cache;
22
    }
23
24
    public function clearCache()
25
    {
26
        $this->cache = [];
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    protected function instantiateFixtures(array $fixtures)
33
    {
34
        parent::instantiateFixtures($fixtures);
35
36
        foreach ($fixtures as $fixture) {
37
            $spec = array_map(function ($property) {
38
                return $property->getValue();
39
            }, $fixture->getProperties());
40
41
            $this->cache[] = [ $spec, $this->objects->get($fixture->getName()) ];
42
        }
43
    }
44
}
45