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

Kunstmaan/AdminBundle/Twig/TabsTwigExtension.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\AdminBundle\Twig;
4
5
use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane;
6
use Twig_Environment;
7
use Twig_Extension;
8
9
/**
10
 * Extension to render tabs
11
 */
12
class TabsTwigExtension 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...
13
{
14
    /**
15
     * Returns a list of functions to add to the existing list.
16
     *
17
     * @return array An array of functions
0 ignored issues
show
Consider making the return type a bit more specific; maybe use \Twig_SimpleFunction[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
18
     */
19
    public function getFunctions()
20
    {
21
        return array(
22
            new \Twig_SimpleFunction('tabs_widget', array($this, 'renderWidget'), array('needs_environment' => true, 'is_safe' => array('html'))),
23
        );
24
    }
25
26
    /**
27
     * @param \Twig_Environment $env
28
     * @param TabPane           $tabPane  The tab pane
29
     * @param array             $options  The extra options
30
     * @param string            $template The template
31
     *
32
     * @return string
33
     */
34 View Code Duplication
    public function renderWidget(Twig_Environment $env, TabPane $tabPane, $options = array(), $template = 'KunstmaanAdminBundle:TabsTwigExtension:widget.html.twig')
35
    {
36
        $template = $env->loadTemplate($template);
37
38
        return $template->render(array_merge($options, array(
39
            'tabPane' => $tabPane,
40
        )));
41
    }
42
}
43