Passed
Push — master ( 068631...f59242 )
by Svaťa
12:34
created

ContainerBuilderFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 20
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Simara\Cart\Infrastructure\Symfony;
6
7
use Simara\Cart\Application\CartUseCase;
8
use Simara\Cart\Application\CartUseCaseApplication;
9
use Simara\Cart\Domain\Cart\CartRepository;
10
use Simara\Cart\Domain\Prices\Prices;
11
use Simara\Cart\Infrastructure\CsvPrices;
12
use Simara\Cart\Infrastructure\MemoryCartRepository;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder 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...
14
15
class ContainerBuilderFactory
16
{
17
    public static function create(
18
        string $pricesCsvPath,
19
    ): ContainerBuilder {
20
        $containerBuilder = new ContainerBuilder();
21
22
        $containerBuilder
23
            ->register(CartRepository::class, MemoryCartRepository::class);
24
25
        $containerBuilder
26
            ->register(Prices::class, CsvPrices::class)
27
            ->addArgument($pricesCsvPath);
28
29
        $containerBuilder
30
            ->register(CartUseCase::class, CartUseCaseApplication::class)
31
            ->setAutowired(true)
32
            ->setPublic(true);
33
34
        $containerBuilder->compile();
35
36
        return $containerBuilder;
37
    }
38
}
39