Completed
Push — master ( 770316...74fc07 )
by Jeroen
09:08 queued 02:44
created

UtilitiesBundle/Twig/UtilitiesTwigExtension.php (2 issues)

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\UtilitiesBundle\Twig;
4
5
use Kunstmaan\UtilitiesBundle\Helper\SlugifierInterface;
6
7
class UtilitiesTwigExtension 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 SlugifierInterface
11
     */
12
    private $slugifier;
13
14
    /**
15
     * @param $slugifier
16
     */
17
    public function __construct($slugifier)
18
    {
19
        $this->slugifier = $slugifier;
20
    }
21
22
    /**
23
     * Returns a list of filters.
24
     *
25
     * @return array An array of filters
26
     */
27
    public function getFilters()
28
    {
29
        return array(
30
            new \Twig_SimpleFilter('slugify', [$this, 'slugify']),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFilter has been deprecated with message: since Twig 2.7, use "Twig\TwigFilter" 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...
31
        );
32
    }
33
34
    /**
35
     * @param string $text
36
     *
37
     * @return string
38
     */
39
    public function slugify($text)
40
    {
41
        return $this->slugifier->slugify($text);
42
    }
43
}
44