Passed
Push — master ( e0359e...d93dbb )
by Jean-Bernard
02:04
created

ReRouteControllerModel::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Symfony-Util package.
5
 *
6
 * (c) Jean-Bernard Addor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SymfonyUtil\Component\HttpFoundation;
13
14
// Similar namespace in Symfony
15
// https://github.com/symfony/symfony/tree/v3.3.8/src/Symfony/Component/Routing/Generator
16
17
use Symfony\Component\HttpFoundation\Request;
18
use Symfony\Component\HttpFoundation\Response;
19
20
// Used from same namespace
21
// ReRouteControllerModelInterface
22
// ReRouteInterface
23
// ResponseParameters
24
25
class ReRouteControllerModel implements ReRouteControllerModelInterface
26
{
27
    protected $reRoute;
28
29
    public function __construct(ReRouteInterface $reRoute)
30
    {
31
        $this->reRoute = $reRoute;
32
    }
33
34
    /**
35
     * Returns ResponseParameters to the given route with the given parameters.
36
     *
37
     * @param string $route      The name of the route
38
     * @param mixed  $parameters An array of parameters
39
     *
40
     * @return Response
41
     *
42
     * @see Interface ReRouteControllerModelInterface
43
     */
44
    public function __invoke($route, $parameters = [], Request $request = null)
45
    {
46
        return new ResponseParameters([], $this->reRoute($route, $parameters));
0 ignored issues
show
Bug introduced by
The method reRoute() does not seem to exist on object<SymfonyUtil\Compo...ReRouteControllerModel>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
    }
48
}
49
50
// Inspired from https://github.com/symfony/symfony/blob/v3.3.8/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php
51