Completed
Push — 8.x-1.x ( 630823...f12348 )
by
unknown
30:40
created

Method::modifyRouteClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Drupal\controller_annotations\Configuration;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method as BaseMethod;
6
use Symfony\Component\Routing\Route as RoutingRoute;
7
8
/**
9
 * @Annotation
10
 */
11
class Method extends BaseMethod implements RouteModifierMethodInterface, RouteModifierClassInterface
12
{
13
    /**
14
     * @param RoutingRoute $route
15
     * @param \ReflectionClass $class
16
     * @param \ReflectionMethod $method
17
     */
18 7
    public function modifyRouteClass(RoutingRoute $route, \ReflectionClass $class, \ReflectionMethod $method)
19
    {
20 7
        $this->modifyRoute($route);
21 7
    }
22
23
    /**
24
     * @param RoutingRoute $route
25
     * @param \ReflectionClass $class
26
     * @param \ReflectionMethod $method
27
     */
28 7
    public function modifyRouteMethod(RoutingRoute $route, \ReflectionClass $class, \ReflectionMethod $method)
29
    {
30 7
        $this->modifyRoute($route);
31 7
    }
32
33
    /**
34
     * we need to make sure this is an array instead of a string which is different in Symfony Framework
35
     * otherwise the support for defining an array of methods will not work as expected
36
     *
37
     * @param RoutingRoute $route
38
     */
39 8
    protected function modifyRoute(RoutingRoute $route)
40
    {
41 8
        $route->setMethods($this->getMethods());
42 8
    }
43
}
44