CategoryServiceFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Category\Factory\Service;
6
7
use Category\Filter\CategoryFilter;
8
use Category\Mapper\CategoryMapper;
9
use Category\Service\CategoryService;
10
use Interop\Container\ContainerInterface;
11
use UploadHelper\Upload;
12
13
class CategoryServiceFactory
14
{
15
    /**
16
     * Executed when factory is invoked.
17
     *
18
     * @param ContainerInterface $container
19
     *
20
     * @return CategoryService
21
     */
22
    public function __invoke(ContainerInterface $container): CategoryService
23
    {
24
        $config = $container->get('config')['upload'];
25
        $upload = new Upload($config['public_path'], $config['non_public_path']);
26
27
        return new CategoryService(
28
            $container->get(CategoryMapper::class),
29
            $container->get(CategoryFilter::class),
30
            $upload
31
        );
32
    }
33
}
34