AdminUserServiceFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4

1 Method

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