Amock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 36
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A __construct() 0 8 1
A get() 0 6 1
1
<?php
2
3
namespace Amock;
4
5
use PHPUnit\Framework\TestCase;
6
7
class Amock
8
{
9
    private $loader;
10
11
    private $parser;
12
13
    private $stubConfiguration;
14
15 11
    public static function create(Configuration $config, TestCase $testCase): Amock
16
    {
17 11
        $loader = Loader\LoaderFactory::create(
18 11
            $config->getSourceType(),
19 11
            $config->getValue()
20
        );
21
22 10
        $parser = Parser\ParserFactory::create($config->getType());
23
24 9
        return new Amock($loader, $parser, new StubConfiguration($testCase));
25
    }
26
27 10
    public function __construct(
28
        Loader\Loader $loader,
29
        Parser\Parser $parser,
30
        StubConfiguration $stubConfiguration
31
    ) {
32 10
        $this->loader = $loader;
33 10
        $this->parser = $parser;
34 10
        $this->stubConfiguration = $stubConfiguration;
35 10
    }
36
37 10
    public function get(string $objectId)
38
    {
39 10
        $this->parser->parse($this->loader->get());
40 10
        $this->stubConfiguration->setStubConfigurationArray($this->parser[$objectId]);
41
42 10
        return $this->stubConfiguration->getStub();
43
    }
44
}
45