Completed
Push — master ( 7d0ef3...14c63c )
by WEBEWEB
03:01
created

materialDesignIconicFontIconFunction()   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\Plugin;
13
14
use Twig_SimpleFilter;
15
use Twig_SimpleFunction;
16
use WBW\Bundle\BootstrapBundle\Twig\Extension\IconRendererTwigExtensionInterface;
17
use WBW\Library\Core\Utility\Argument\ArrayUtility;
18
19
/**
20
 * Material Design Iconic Font Twig extension.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\BootstrapBundle\Twig\Extension\Plugin
24
 */
25
class MaterialDesignIconicFontTwigExtension extends AbstractMaterialDesignIconicFontTwigExtension implements IconRendererTwigExtensionInterface {
26
27
    /**
28
     * Service name.
29
     *
30
     * @var string
31
     */
32
    const SERVICE_NAME = "webeweb.bootstrapbundle.twig.extension.plugin.materialdesigniconicfont";
33
34
    /**
35
     * Constructor.
36
     */
37
    public function __construct() {
38
        parent::__construct();
39
    }
40
41
    /**
42
     * Get the Twig filters.
43
     *
44
     * @return Twig_SimpleFilter[] Returns the Twig filters.
45
     */
46
    public function getFilters() {
47
        return [
48
            new Twig_SimpleFilter("materialDesignIconicFontList", [$this, "materialDesignIconicFontListFilter"], ["is_safe" => ["html"]]),
49
            new Twig_SimpleFilter("materialDesignIconicFontListIcon", [$this, "materialDesignIconicFontListIconFilter"], ["is_safe" => ["html"]]),
50
        ];
51
    }
52
53
    /**
54
     * Get the Twig functions.
55
     *
56
     * @return array Returns the Twig functions.
57
     */
58
    public function getFunctions() {
59
        return [
60
            new Twig_SimpleFunction("materialDesignIconicFontIcon", [$this, "materialDesignIconicFontIconFunction"], ["is_safe" => ["html"]]),
61
        ];
62
    }
63
64
    /**
65
     * Displays a Material Design Iocnic Font icon.
66
     *
67
     * @param array $args The arguments.
68
     * @return Returns the Material Design Iconic Font icon.
69
     */
70
    public function materialDesignIconicFontIconFunction(array $args = []) {
71
        return $this->materialDesignIconicFontIcon(ArrayUtility::get($args, "name", "home"), ArrayUtility::get($args, "size"), ArrayUtility::get($args, "fixedWidth", false), ArrayUtility::get($args, "border", false), ArrayUtility::get($args, "pull"), ArrayUtility::get($args, "spin"), ArrayUtility::get($args, "rotate"), ArrayUtility::get($args, "flip"), ArrayUtility::get($args, "style"));
72
    }
73
74
    /**
75
     * Displays a Material Design Iconic Font list.
76
     *
77
     * @param array|string $items The list items.
78
     * @return string Returns the Material Design Iconic Font list.
79
     */
80
    public function materialDesignIconicFontListFilter($items) {
81
        return $this->materialDesignIconicFontList($items);
82
    }
83
84
    /**
85
     * Displays a Material Design Iconic Font list icon.
86
     *
87
     * @param string $icon The Material Design Iconic Font icon.
88
     * @param string $content The Material Design Iconic Font content.
89
     * @return string Returns the Material Design Iconic Font list icon.
90
     */
91
    public function materialDesignIconicFontListIconFilter($icon, $content) {
92
        return $this->materialDesignIconicFontListIcon($icon, $content);
93
    }
94
95
    /**
96
     * {@inheritdoc}
97
     */
98
    public function renderIcon($name, $style) {
99
        return $this->materialDesignIconicFontIconFunction(["name" => $name, "style" => $style]);
100
    }
101
102
}
103