AbstractControllerProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 11
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A addController() 0 23 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Controller\Business\Model\Route;
6
7
8
use DataProvider\RouteDataProvider;
9
use Xervice\Web\Business\Dependency\Plugin\AbstractWebProviderPlugin;
10
11
abstract class AbstractControllerProvider extends AbstractWebProviderPlugin
12
{
13 6
    public function addController(
14
        string $path,
15
        string $controller,
16
        string $action,
17
        array $methods
18
    ): RouteDataProvider
19
    {
20 6
        $route = new RouteDataProvider();
21
22
        $route
23 6
            ->setName($controller . '::' . $action)
24 6
            ->setPath($path)
25 6
            ->setDefaults(
26
                [
27 6
                    '_controller' => $controller,
28 6
                    '_action' => $action
29
                ]
30
            )
31 6
            ->setMethods(
32 6
                $methods
33
            );
34
35 6
        return $route;
36
    }
37
}