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

RouteMethodsBase::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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