Completed
Pull Request — 8.x-1.x (#7)
by
unknown
65:17
created

RouteMethodsBase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A modifyRoute() 0 4 1
1
<?php
2
3
namespace Drupal\controller_annotations\RouteModifier;
4
5
use Symfony\Component\Routing\Route;
6
7
abstract class RouteMethodsBase implements RouteModifierInterface
8
{
9
10
    /**
11
     * @var string[]
12
     */
13
    private $methods;
14
15
    /**
16
     * @param string[] $methods
17
     *   E.g. ['GET', 'POST'].
18
     */
19
    protected function __construct(array $methods)
20
    {
21
        $this->methods = $methods;
22
    }
23
24
    /**
25
     * @param \Symfony\Component\Routing\Route $route
26
     */
27
    public function modifyRoute(Route $route)
28
    {
29
        $route->setMethods($this->methods);
30
    }
31
}
32