Completed
Push — master ( a2b9d1...d3fba9 )
by WEBEWEB
01:53
created

ColorTwigExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A adminBSBColorMaterialDesignFunction() 0 3 1
A getFunctions() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the adminbsb-material-design-bundle package.
5
 *
6
 * (c) 2017 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\AdminBSBBundle\Twig\Extension\UI;
13
14
use Twig_SimpleFunction;
15
use WBW\Library\Core\Argument\ArrayHelper;
16
17
/**
18
 * Color Twig extension.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI
22
 */
23
class ColorTwigExtension extends AbstractColorTwigExtension {
24
25
    /**
26
     * Service name.
27
     *
28
     * @var string
29
     */
30
    const SERVICE_NAME = "webeweb.adminbsb.twig.extension.ui.color";
31
32
    /**
33
     * Displays an AdminBSB color "Material design".
34
     *
35
     * @param array $args The arguments.
36
     * @return string Returns the AdminBSB color "Material design".
37
     */
38
    public function adminBSBColorMaterialDesignFunction(array $args = []) {
39
        return $this->adminBSBColor(ArrayHelper::get($args, "name"), ArrayHelper::get($args, "code", "500"), ArrayHelper::get($args, "out", "class"));
40
    }
41
42
    /**
43
     * Get the Twig functions.
44
     *
45
     * @return array Returns the Twig functions.
46
     */
47
    public function getFunctions() {
48
        return [
49
            new Twig_SimpleFunction("adminBSBColorMaterialDesign", [$this, "adminBSBColorMaterialDesignFunction"], ["is_safe" => ["html"]]),
50
        ];
51
    }
52
}
53