Completed
Push — master ( 75c543...b51150 )
by max
02:14
created

ConfigFactory::createService()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 13
rs 9.4285
cc 2
eloc 8
nc 2
nop 1
1
<?php
2
3
namespace T4web\Cron;
4
5
use Zend\ServiceManager\ServiceLocatorInterface;
6
use Zend\ServiceManager\FactoryInterface;
7
use Cron\Cron;
8
use T4web\Cron\Resolver\ArrayResolver;
9
use T4web\Cron\Executor\Executor;
10
use T4web\Cron\Config;
11
12
class ConfigFactory implements FactoryInterface
13
{
14
    /**
15
     * Create service
16
     *
17
     * @param ServiceLocatorInterface $serviceLocator
18
     * @return Config
19
     */
20
    public function createService(ServiceLocatorInterface $serviceLocator)
21
    {
22
        $appConfig = $serviceLocator->get('Config');
23
        $config = [];
24
        if (isset($appConfig['cron'])) {
25
            $config = $appConfig['cron'];
26
        }
27
28
        return new Config(
29
            $config,
30
            new FileSystem()
31
        );
32
    }
33
}
34