ContainerExampleController::addRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 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