Completed
Push — master ( b9d832...421ea6 )
by Phil
06:19 queued 04:14
created

ParamStrategy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 21
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A dispatch() 0 15 2
1
<?php
2
3
namespace League\Route\Strategy;
4
5
use League\Route\Http\Exception as HttpException;
6
use League\Route\Route;
7
use RuntimeException;
8
9
class ParamStrategy extends AbstractStrategy implements StrategyInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 6
    public function dispatch(callable $controller, array $vars, Route $route = null)
15
    {
16 6
        if (method_exists($this->getContainer(), 'call')) {
17 3
            $response = $this->getContainer()->call($controller, $vars);
18
19 3
            return $this->determineResponse($response);
20
        }
21
22 3
        throw new RuntimeException(
23 3
            sprintf(
24 3
                'To use the parameter strategy, the container must implement the (::call) method. (%s) does not.',
25 3
                get_class($this->getContainer())
26 3
            )
27 3
        );
28
    }
29
}
30