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

DbConfigHydratorFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 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