Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

NodeBundle/Twig/UrlReplaceTwigExtension.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\NodeBundle\Twig;
4
5
use Kunstmaan\NodeBundle\Helper\URLHelper;
6
7
class UrlReplaceTwigExtension extends \Twig_Extension
0 ignored issues
show
Deprecated Code introduced by
The class Twig_Extension has been deprecated with message: since Twig 2.7, use "Twig\Extension\AbstractExtension" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
8
{
9
    /**
10
     * @var URLHelper
11
     */
12
    private $urlHelper;
13
14
    /**
15
     * @param URLHelper $urlHelper
16
     */
17
    public function __construct(URLHelper $urlHelper)
18
    {
19
        $this->urlHelper = $urlHelper;
20
    }
21
22
    /**
23
     * @return array
24
     */
25
    public function getFilters()
26
    {
27
        return array(
28
            new \Twig_SimpleFilter('replace_url', array($this, 'replaceUrl')),
29
        );
30
    }
31
32
    public function replaceUrl($text)
33
    {
34
        return $this->urlHelper->replaceUrl($text);
35
    }
36
}
37