Completed
Pull Request — master (#2094)
by Sander
50:34 queued 34:10
created

Kunstmaan/AdminBundle/Twig/TabsTwigExtension.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\AdminBundle\Twig;
4
5
use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane;
6
use Twig_Environment;
7
8
use Twig_Extension;
9
10
/**
11
 * Extension to render tabs
12
 */
13
class TabsTwigExtension extends Twig_Extension
14
{
15
    /**
16
     * Returns a list of functions to add to the existing list.
17
     *
18
     * @return array An array of functions
19
     */
20
    public function getFunctions()
21
    {
22
        return array(
23
            new \Twig_SimpleFunction('tabs_widget', array($this, 'renderWidget'), array('needs_environment' => true, 'is_safe' => array('html')))
24
        );
25
    }
26
27
    /**
28
     * @param \Twig_Environment $env
29
     * @param TabPane           $tabPane  The tab pane
30
     * @param array             $options  The extra options
31
     * @param string            $template The template
32
     *
33
     * @return string
34
     */
35 View Code Duplication
    public function renderWidget(Twig_Environment $env, TabPane $tabPane, $options = array(), $template = "KunstmaanAdminBundle:TabsTwigExtension:widget.html.twig")
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
    {
37
        $template = $env->loadTemplate($template);
38
39
        return $template->render(array_merge($options, array(
40
            'tabPane' => $tabPane
41
        )));
42
    }
43
}
44