TemplateServiceFactory::createService()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
ccs 7
cts 7
cp 1
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Columnis\Service\Factory;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use Columnis\Service\TemplateService;
8
9
class TemplateServiceFactory implements FactoryInterface
10
{
11
    /**
12
     * {@inheritDoc}
13
     *
14
     * @return TemplateService
15
     */
16 15
    public function createService(ServiceLocatorInterface $serviceLocator)
17
    {
18 15
        $templatesPathStack = array();
19
        
20 15
        $config      = $serviceLocator->get('Config');
21
        
22 15
        if (isset($config['view_manager']['template_path_stack'])) {
23 15
            $templatesPathStack = $config['view_manager']['template_path_stack'];
24 15
        }
25
        
26 15
        return new TemplateService($templatesPathStack);
27
    }
28
}
29