DbConfigHydratorFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlowServer\Db\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use SlayerBirden\DataFlowServer\Doctrine\Hydrator\Strategy\NestedEntityStrategy;
8
use SlayerBirden\DataFlowServer\Doctrine\Hydrator\Strategy\ObscuredStrategy;
9
use SlayerBirden\DataFlowServer\Doctrine\Hydrator\Strategy\RegexpObscuredStrategy;
10
use Zend\Hydrator\ClassMethods;
11
use Zend\Hydrator\HydratorInterface;
12
use Zend\ServiceManager\Factory\FactoryInterface;
13
14
final class DbConfigHydratorFactory implements FactoryInterface
15
{
16
    /**
17
     * @inheritdoc
18
     */
19 30
    public function __invoke(
20
        ContainerInterface $container,
21
        $requestedName,
22
        array $options = null
23
    ): HydratorInterface {
24 30
        $extraction = new ClassMethods();
25 30
        $extraction->addStrategy('owner', new NestedEntityStrategy(new ClassMethods()));
26 30
        $extraction->addStrategy('password', new ObscuredStrategy());
27 30
        $extraction->addStrategy('url', new RegexpObscuredStrategy(
28 30
            '/:\w+@/',
29 30
            ':*****@'
30
        ));
31
32 30
        return $extraction;
33
    }
34
}
35