Completed
Push — develop ( f102ca...488b09 )
by Mathias
20:12 queued 11:00
created

LogStrategyFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 8
dl 0
loc 18
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 5
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2019 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Core\Queue\Strategy;
12
13
use Interop\Container\ContainerInterface;
14
use Psr\Log\NullLogger;
15
use Zend\Log\LoggerInterface;
16
use Zend\ServiceManager\Factory\FactoryInterface;
17
18
/**
19
 * Factory for \Core\Queue\Strategy\LogStrategy
20
 * 
21
 * @author Mathias Gelhausen <[email protected]>
22
 * @todo write test  
23
 */
24
class LogStrategyFactory implements FactoryInterface
25
{
26
    
27
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
28
    {
29
        $log = isset($options['log']) ? $options['log'] : null;
30
31
        if ($log && $container->has($log)) {
32
            $log = $container->get($log);
33
        }
34
35
        if (!$log instanceOf LoggerInterface) {
36
            $log = null;
37
        }
38
39
        $service = new LogStrategy($log);
40
        
41
        return $service;    
42
    }
43
}
44