Completed
Push — master ( fa4abd...e15627 )
by WEBEWEB
02:20
created

fontAwesomeFunction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
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\Plugin;
13
14
use Twig_SimpleFunction;
15
use WBW\Library\Core\Utility\Argument\ArrayUtility;
16
17
/**
18
 * Font Awesome plugin Twig extension.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\BootstrapBundle\Twig\Extension\Plugin
22
 */
23
class FontAwesomePluginTwigExtension extends AbstractPluginTwigExtension {
24
25
    /**
26
     * Service name.
27
     *
28
     * @var string
29
     */
30
    const SERVICE_NAME = "webeweb.bundle.bootstrapbundle.twig.extension.plugin.fontawesome";
31
32
    /**
33
     * Constructor.
34
     */
35
    public function __construct() {
36
        parent::__construct();
37
    }
38
39
    /**
40
     * Displays a Font Awesome.
41
     *
42
     * @param array $args The arguments.
43
     * @return Returns a Font Awesome.
44
     */
45
    public function fontAwesomeFunction(array $args = []) {
46
        return $this->fontAwesome(ArrayUtility::get($args, "style"), ArrayUtility::get($args, "name", "home"), ArrayUtility::get($args, "size"), ArrayUtility::get($args, "fixedWidth", false), ArrayUtility::get($args, "bordered", false), ArrayUtility::get($args, "pull"), ArrayUtility::get($args, "animated"));
47
    }
48
49
    /**
50
     * Get the Twig functions.
51
     *
52
     * @return array Returns the Twig functions.
53
     */
54
    public function getFunctions() {
55
        return [
56
            new Twig_SimpleFunction("fontAwesome", [$this, "fontAwesomeFunction"], ["is_safe" => ["html"]]),
57
        ];
58
    }
59
60
}
61