Completed
Push — master ( 4f6c77...210608 )
by Alexander
11s
created

AspectContainerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2016, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\ZF2\GoAopModule\Factory;
12
13
use Go\Core\AspectKernel;
14
use Interop\Container\ContainerInterface;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18
class AspectContainerFactory implements FactoryInterface
19
{
20
21
    /**
22
     * Create service
23
     *
24
     * This method gains ZF3 compatibility
25
     *
26
     * @param ContainerInterface $container
27
     * @param string             $requestedName
28
     * @param array              $options
29
     *
30
     * @return mixed
31
     */
32
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
33
    {
34
        return $this->createService($container);
35
    }
36
37
    /**
38
     * Create service
39
     *
40
     * @param ServiceLocatorInterface $serviceLocator
41
     *
42
     * @return mixed
43
     */
44
    public function createService(ServiceLocatorInterface $serviceLocator)
45
    {
46
        /** @var AspectKernel $kernel */
47
        $kernel = $serviceLocator->get(AspectKernel::class);
48
49
        return $kernel->getContainer();
50
    }
51
}
52