Completed
Push — master ( f99e05...615cfa )
by
unknown
01:35
created

AspectContainerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A createService() 0 7 1
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\Zend\Framework\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
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
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);
0 ignored issues
show
Compatibility introduced by
$container of type object<Interop\Container\ContainerInterface> is not a sub-type of object<Zend\ServiceManag...erviceLocatorInterface>. It seems like you assume a child interface of the interface Interop\Container\ContainerInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
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