ServiceExampleController   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 2
dl 0
loc 64
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A addRoutes() 0 7 1
A __construct() 0 4 1
A setTestData1() 0 4 1
A setTestData2() 0 4 1
A indexAction() 0 10 4
1
<?php
2
3
namespace Saxulum\SaxulumControllerProvider\Controller;
4
5
use Silex\Application;
6
7
class ServiceExampleController implements ControllerRouteInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $testData;
13
14
    /**
15
     * @var array
16
     */
17
    protected $testData1;
18
19
    /**
20
     * @var array
21
     */
22
    protected $testData2;
23
24
    /**
25
     * @param Application $app
26
     * @param string      $serviceId
27
     */
28
    public static function addRoutes(Application $app, $serviceId)
29
    {
30
        $app
31
            ->get('/service', $serviceId . ':indexAction')
32
            ->bind('service_index')
33
        ;
34
    }
35
36
    /**
37
     * @param array $testData
38
     */
39
    public function __construct(array $testData)
40
    {
41
        $this->testData = $testData;
42
    }
43
44
    /**
45
     * @param array $testData1
46
     */
47
    public function setTestData1(array $testData1)
48
    {
49
        $this->testData1 = $testData1;
50
    }
51
52
    /**
53
     * @param array $testData2
54
     */
55
    public function setTestData2(array $testData2)
56
    {
57
        $this->testData2 = $testData2;
58
    }
59
60
    public function indexAction()
61
    {
62
        if(array_key_exists('key1', $this->testData) &&
63
           array_key_exists('key1', $this->testData1) &&
64
           array_key_exists('key1', $this->testData2)) {
65
            return 'ok';
66
        }
67
68
        return 'failed';
69
    }
70
}
71