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

ProgressBarTwigExtension::getFilters()   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 0
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_SimpleFilter;
15
use Twig_SimpleFunction;
16
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractTwigExtension;
17
use WBW\Bundle\BootstrapBundle\Twig\Extension\Component\ProgressBarTwigExtension as BaseTwigExtension;
18
use WBW\Library\Core\Argument\ArrayHelper;
19
20
/**
21
 * Progress bar Twig extension.
22
 *
23
 * @author webeweb <https://github.com/webeweb/>
24
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI
25
 */
26
class ProgressBarTwigExtension extends BaseTwigExtension {
27
28
    /**
29
     * Service name.
30
     *
31
     * @var string
32
     */
33
    const SERVICE_NAME = "webeweb.adminbsb.twig.extension.ui.progress_bar";
34
35
    /**
36
     * Displays an AdminBSB progress bar "Material design".
37
     *
38
     * @param array $args The arguments.
39
     * @return string Returns the AdminBSB progress bar "Material design".
40
     */
41
    public function adminBSBProgressBarMaterialDesignFunction(array $args = []) {
42
        return $this->bootstrapProgressBar(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "value", 50), ArrayHelper::get($args, "min", 0), ArrayHelper::get($args, "max", 100), ArrayHelper::get($args, "striped", false), ArrayHelper::get($args, "animated", false), AbstractTwigExtension::fixColor(ArrayHelper::get($args, "color", "red"), "bg-"));
43
    }
44
45
    /**
46
     * Get the Twig filters.
47
     *
48
     * @return Twig_SimpleFilter[] Returns the Twig filters.
49
     */
50
    public function getFilters() {
51
        return [];
52
    }
53
54
    /**
55
     * Get the Twig functions.
56
     *
57
     * @return array Returns the Twig functions.
58
     */
59
    public function getFunctions() {
60
        return [
61
            new Twig_SimpleFunction("adminBSBProgressBarBasic", [$this, "bootstrapProgressBarBasicFunction"], ["is_safe" => ["html"]]),
62
            new Twig_SimpleFunction("adminBSBProgressBarDanger", [$this, "bootstrapProgressBarDangerFunction"], ["is_safe" => ["html"]]),
63
            new Twig_SimpleFunction("adminBSBProgressBarInfo", [$this, "bootstrapProgressBarInfoFunction"], ["is_safe" => ["html"]]),
64
            new Twig_SimpleFunction("adminBSBProgressBarMaterialDesign", [$this, "adminBSBProgressBarMaterialDesignFunction"], ["is_safe" => ["html"]]),
65
            new Twig_SimpleFunction("adminBSBProgressBarSuccess", [$this, "bootstrapProgressBarSuccessFunction"], ["is_safe" => ["html"]]),
66
            new Twig_SimpleFunction("adminBSBProgressBarWarning", [$this, "bootstrapProgressBarWarningFunction"], ["is_safe" => ["html"]]),
67
        ];
68
    }
69
}
70