AbstractWebProviderPlugin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createRoute() 0 22 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\Web\Business\Dependency\Plugin;
5
6
7
use DataProvider\RouteDataProvider;
8
9
abstract class AbstractWebProviderPlugin implements WebProviderPluginInterface
10
{
11
    /**
12
     * @param string $name
13
     * @param string $path
14
     * @param array $options
15
     * @param callable $callable
16
     *
17
     * @return \DataProvider\RouteDataProvider
18
     */
19 2
    public function createRoute(
20
        string $name,
21
        string $path,
22
        array $options,
23
        callable $callable
24
    ): RouteDataProvider
25
    {
26 2
        $route = new RouteDataProvider();
27
28
        $route
29 2
            ->setName($name)
30 2
            ->setPath($path)
31 2
            ->setDefaults(
32
                [
33 2
                    '_controller' => $callable
34
                ]
35
            )
36 2
            ->setMethods(
37 2
                $options['methods'] ?? []
38
            );
39
40 2
        return $route;
41
    }
42
}