Completed
Push — master ( c0a77a...dfe684 )
by WEBEWEB
01:34
created

AbstractMeteoconsTwigExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A meteoconsIcon() 0 12 1
1
<?php
2
3
/**
4
 * This file is part of the core-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\CoreBundle\Twig\Extension\Plugin;
13
14
use Twig_Environment;
15
use WBW\Bundle\CoreBundle\Twig\Extension\AbstractTwigExtension;
16
17
/**
18
 * Abstract Meteocons Twig extension.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\CoreBundle\Twig\Extension\Plugin
22
 * @abstract
23
 */
24
abstract class AbstractMeteoconsTwigExtension extends AbstractTwigExtension {
25
26
    /**
27
     * Constructor.
28
     *
29
     * @param Twig_Environment $twigEnvironment The twig environment.
30
     */
31
    protected function __construct(Twig_Environment $twigEnvironment) {
32
        parent::__construct($twigEnvironment);
33
    }
34
35
    /**
36
     * Displays a Meteocons icon.
37
     *
38
     * @param string $name The name.
39
     * @param string $style The style.
40
     * @return string Returns the Meteocons icon.
41
     */
42
    protected function meteoconsIcon($name, $style) {
43
44
        // Initialize the attributes.
45
        $attributes = [];
46
47
        $attributes["class"]          = "meteocons";
48
        $attributes["data-meteocons"] = $name;
49
        $attributes["style"]          = $style;
50
51
        // Return the HTML.
52
        return static::coreHTMLElement("i", null, $attributes);
53
    }
54
55
}
56