ServiceControllerActionProxy   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 4
c 3
b 0
f 2
cbo 3
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A instantiate() 0 4 1
1
<?php
2
namespace Fwk\Core\Action;
3
4
use Fwk\Core\Application;
5
6
class ServiceControllerActionProxy extends AbstractControllerActionProxy 
7
{
8
    protected $serviceName;
9
    
10
    protected $method;
11
12 17
    public function __construct($serviceName, $method)
13
    {
14 17
        if (empty($serviceName) || empty($method)) {
15 1
            throw new \InvalidArgumentException("Controller service name and method cannot be empty");
16
        }
17
        
18 16
        $this->serviceName  = $serviceName;
19 16
        $this->method       = $method;
20 16
    }
21
    
22
    /**
23
     * Instanciates the controller class
24
     * 
25
     * @return mixed
26
     */
27 2
    protected function instantiate(Application $app)
28
    {
29 2
        return $app->getServices()->get($this->serviceName);
30
    }
31
}
32