ContainerExampleController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addRoutes() 0 7 1
A __construct() 0 4 1
A indexAction() 0 4 2
1
<?php
2
3
namespace Saxulum\SaxulumControllerProvider\Controller;
4
5
use Silex\Application;
6
7
class ContainerExampleController implements ControllerRouteInterface
8
{
9
    /**
10
     * @var \Pimple
11
     */
12
    protected $container;
13
14
    /**
15
     * @param Application $app
16
     * @param string      $serviceId
17
     */
18
    public static function addRoutes(Application $app, $serviceId)
19
    {
20
        $app
21
            ->get('/container', $serviceId . ':indexAction')
22
            ->bind('container_index')
23
        ;
24
    }
25
26
    /**
27
     * @param \Pimple $container
28
     */
29
    public function __construct(\Pimple $container)
30
    {
31
        $this->container = $container;
32
    }
33
34
    public function indexAction()
35
    {
36
        return $this->container instanceof \Pimple ? 'ok': 'failed';
37
    }
38
}
39