Completed
Push — master ( ba9a91...2a62e7 )
by WEBEWEB
02:17
created

bootstrapDropdownHeaderFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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 Twig_SimpleFunction;
15
use WBW\Library\Core\Utility\Argument\ArrayUtility;
16
17
/**
18
 * Dropdown component Twig extension.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\BootstrapBundle\Twig\Extension\Component
22
 */
23
class DropdownComponentTwigExtension extends AbstractComponentTwigExtension {
24
25
    /**
26
     * Service name.
27
     *
28
     * @var string
29
     */
30
    const SERVICE_NAME = "webeweb.bootstrapbundle.twig.extension.component.dropdown";
31
32
    /**
33
     * Constructor.
34
     */
35
    public function __construct() {
36
        parent::__construct();
37
    }
38
39
    /**
40
     * Displays a Bootstrap dropdown "Button".
41
     *
42
     * @param array $args The arguments.
43
     * @return string Returns the Bootstrap dropdown "Button".
44
     */
45
    public function bootstrapDropdownButtonFunction(array $args = []) {
46
        return $this->bootstrapDropdownButton(ArrayUtility::get($args, "content"), ArrayUtility::get($args, "id"), ArrayUtility::get($args, "expanded", true), ArrayUtility::get($args, "class", "default"));
47
    }
48
49
    /**
50
     * Displays a Bootstrap dropdown "Divider".
51
     *
52
     * @param array $args The arguments.
53
     * @return string Returns the Bootstrap dropdown "Divider".
54
     */
55
    public function bootstrapDropdownDividerFunction(array $args = []) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
56
        return $this->bootstrapDropdownDivider();
57
    }
58
59
    /**
60
     * Displays a Bootstrap dropdown "Header".
61
     *
62
     * @param array $args The arguments.
63
     * @return string Returns the Bootstrap dropdown "Header".
64
     */
65
    public function bootstrapDropdownHeaderFunction(array $args = []) {
66
        return $this->bootstrapDropdownHeader(ArrayUtility::get($args, "content"));
67
    }
68
69
    /**
70
     * Get the Twig functions.
71
     *
72
     * @return Twig_SimpleFunction[] Returns the Twig functions.
73
     */
74
    public function getFunctions() {
75
        return [
76
            new Twig_SimpleFunction("bootstrapDropdownButton", [$this, "bootstrapDropdownButtonFunction"], ["is_safe" => ["html"]]),
77
            new Twig_SimpleFunction("bootstrapDropdownDivider", [$this, "bootstrapDropdownDividerFunction"], ["is_safe" => ["html"]]),
78
            new Twig_SimpleFunction("bootstrapDropdownHeader", [$this, "bootstrapDropdownHeaderFunction"], ["is_safe" => ["html"]]),
79
        ];
80
    }
81
82
}
83