Passed
Push — main ( 0ba95d...aa44b1 )
by Chema
16:47 queued 10:44
created

RunFactory::createNamespacesLoader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Phel\Run;
6
7
use Gacela\Framework\AbstractFactory;
8
use Phel\Api\ApiFacadeInterface;
9
use Phel\Build\BuildFacadeInterface;
10
use Phel\Command\CommandFacadeInterface;
11
use Phel\Compiler\CompilerFacadeInterface;
12
use Phel\Printer\Printer;
13
use Phel\Printer\PrinterInterface;
14
use Phel\Run\Application\NamespaceRunner;
0 ignored issues
show
Bug introduced by
The type Phel\Run\Application\NamespaceRunner 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...
15
use Phel\Run\Application\NamespacesLoader;
0 ignored issues
show
Bug introduced by
The type Phel\Run\Application\NamespacesLoader 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...
16
use Phel\Run\Domain\Repl\ColorStyle;
17
use Phel\Run\Domain\Repl\ColorStyleInterface;
18
use Phel\Run\Domain\Repl\ReplCommandIoInterface;
19
use Phel\Run\Domain\Repl\ReplCommandSystemIo;
0 ignored issues
show
Bug introduced by
The type Phel\Run\Domain\Repl\ReplCommandSystemIo 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...
20
use Phel\Run\Domain\Runner\NamespaceCollector;
0 ignored issues
show
Bug introduced by
The type Phel\Run\Domain\Runner\NamespaceCollector 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...
21
use Phel\Run\Domain\Runner\NamespaceRunnerInterface;
22
23
/**
24
 * @method RunConfig getConfig()
25
 */
26
class RunFactory extends AbstractFactory
27
{
28 2
    public function createNamespaceRunner(): NamespaceRunnerInterface
29
    {
30 2
        return new NamespaceRunner(
31 2
            $this->getCommandFacade(),
32 2
            $this->getBuildFacade(),
33 2
        );
34
    }
35
36 3
    public function getCommandFacade(): CommandFacadeInterface
37
    {
38 3
        return $this->getProvidedDependency(RunProvider::FACADE_COMMAND);
39
    }
40
41 3
    public function getBuildFacade(): BuildFacadeInterface
42
    {
43 3
        return $this->getProvidedDependency(RunProvider::FACADE_BUILD);
44
    }
45
46
    public function getCompilerFacade(): CompilerFacadeInterface
47
    {
48
        return $this->getProvidedDependency(RunProvider::FACADE_COMPILER);
49
    }
50
51
    public function createNamespaceCollector(): NamespaceCollector
52
    {
53
        return new NamespaceCollector(
54
            $this->getBuildFacade(),
55
            $this->getCommandFacade(),
56
        );
57
    }
58
59
    public function createColorStyle(): ColorStyleInterface
60
    {
61
        return ColorStyle::withStyles();
62
    }
63
64
    public function createPrinter(): PrinterInterface
65
    {
66
        return Printer::readableWithColor();
67
    }
68
69
    public function createReplCommandIo(): ReplCommandIoInterface
70
    {
71
        return new ReplCommandSystemIo(
72
            $this->getConfig()->getPhelReplHistory(),
73
            $this->getCommandFacade(),
74
            $this->getApiFacade(),
75
        );
76
    }
77
78
    public function createNamespacesLoader(): NamespacesLoader
79
    {
80
        return new NamespacesLoader(
81
            $this->getCommandFacade(),
82
            $this->getBuildFacade(),
83
        );
84
    }
85
86
    public function getApiFacade(): ApiFacadeInterface
87
    {
88
        return $this->getProvidedDependency(RunProvider::FACADE_API);
89
    }
90
}
91