Completed
Push — master ( 695906...a2e16e )
by WEBEWEB
19:00
created

Extension/Component/BreadcrumbTwigExtension.php (2 issues)

Severity

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
/*
4
 * This file is part of the bootstrap-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
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 WBW\Bundle\BootstrapBundle\Twig\Extension\Component;
13
14
use Symfony\Component\HttpFoundation\Request;
15
use Twig_SimpleFunction;
16
use WBW\Bundle\CoreBundle\Navigation\NavigationTree;
17
use WBW\Bundle\CoreBundle\Navigation\NavigationTreeHelper;
18
19
/**
20
 * Breadcrumb Twig Extension.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\BootstrapBundle\Twig\Extension\Component
24
 * @link https://getbootstrap.com/docs/3.3/components/#breadcrumbs
25
 */
26
class BreadcrumbTwigExtension extends AbstractBreadcrumbTwigExtension {
27
28
    /**
29
     * Service name.
30
     *
31
     * @var string
32
     */
33
    const SERVICE_NAME = "webeweb.bootstrap.twig.extension.component.breadcrumb";
34
35
    /**
36
     * Displays a Bootstrap breadcrumbs.
37
     *
38
     * @param array $args The arguments.
39
     * @param NavigationTree $tree The tree.
40
     * @param Request $request The request.
41
     * @return string Returns the Bootstrap breadcrumbs.
42
     */
43
    public function bootstrapBreadcrumbsFunction(array $args = [], NavigationTree $tree, Request $request) {
44
        NavigationTreeHelper::activeTree($tree, $request);
45
        return $this->bootstrapBreadcrumbs($tree);
46
    }
47
48
    /**
49
     * Get the Twig functions.
50
     *
51
     * @return Twig_SimpleFunction[] Returns the Twig functions.
52
     */
53
    public function getFunctions() {
54
        return [
55
            new Twig_SimpleFunction("bootstrapBreadcrumbs", [$this, "bootstrapBreadcrumbsFunction"], ["is_safe" => ["html"]]),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" 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...
56
            new Twig_SimpleFunction("bsBreadcrumbs", [$this, "bootstrapBreadcrumbsFunction"], ["is_safe" => ["html"]]),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" 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...
57
        ];
58
    }
59
}
60