Completed
Push — master ( 178a08...5c0b6f )
by Oleg
05:22
created

DbConfigHydratorFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
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 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

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