Passed
Push — master ( 3599ac...dd3b28 )
by Gerhard
28:15 queued 18:09
created

Bundle/RoutingBundle/Twig/RouterExtension.php (1 issue)

Severity
1
<?php
2
/**
3
 * UrlResolver.php
4
 *
5
 * @since 12/10/16
6
 * @author gseidel
7
 */
8
9
namespace Enhavo\Bundle\RoutingBundle\Twig;
10
11
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12
use Enhavo\Bundle\RoutingBundle\Router\Router;
13
use Twig\Extension\AbstractExtension;
14
use Twig\TwigFunction;
15
16
class RouterExtension extends AbstractExtension
17
{
18
    /**
19
     * @var Router
20
     */
21
    private $router;
22
23
    /**
24
     * RouterExtension constructor.
25
     *
26
     * @param Router $router
27
     */
28
    public function __construct(Router $router)
29
    {
30
        $this->router = $router;
31
    }
32
33
    public function getFunctions()
34
    {
35
        return array(
36
            new TwigFunction('router', array($this, 'generate')),
37
        );
38
    }
39
40
    /**
41
     * @param $resource
42
     * @param array $parameters
43
     * @param int $referenceType
44
     * @param string $type
45
     * @return string
46
     */
47
    public function generate($resource , $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, $type = 'default')
0 ignored issues
show
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

47
    public function generate($resource , $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH, /** @scrutinizer ignore-unused */ $type = 'default')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        return $this->router->generate($resource , $parameters, $referenceType, $type = 'default');
50
    }
51
}
52