Completed
Push — develop ( 9659b8...659b85 )
by Mathias
13:02
created

PurgeControllerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 2
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2018 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Core\Controller\Console;
12
13
use Interop\Container\ContainerInterface;
14
use Zend\ServiceManager\Factory\FactoryInterface;
15
16
/**
17
 * Factory for \Core\Controller\Console\PurgeController
18
 * 
19
 * @author Mathias Gelhausen <[email protected]>
20
 * @todo write test  
21
 */
22
class PurgeControllerFactory implements FactoryInterface
23
{
24
    
25
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
26
    {
27
        /* @var \Zend\Router\RouteMatch $routeMatch */
28
        $controller = new PurgeController();
29
        $application = $container->get('Application');
30
        $routeMatch  = $application->getMvcEvent()->getRouteMatch();
31
32
        if ('index' != $routeMatch->getParam('action')) {
33
            $events = $container->get('Core/EntityEraser/Load/Events');
34
            $controller->setLoadEvents($events);
35
        }
36
37
        
38
        return $controller;
39
    }
40
}
41