Completed
Push — master ( 10f697...c17cc0 )
by WEBEWEB
02:43
created

AbstractPreloaderTwigExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A adminBSBPreloader() 0 18 2
1
<?php
2
3
/**
4
 * This file is part of the adminbsb-material-design-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\AdminBSBBundle\Twig\Extension\UI;
13
14
use WBW\Bundle\AdminBSBBundle\Twig\Extension\AbstractAdminBSBTwigExtension;
15
16
/**
17
 * Abstract preloader Twig extension.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\AdminBSBBundle\Twig\Extension\UI
21
 * @abstract
22
 */
23
abstract class AbstractPreloaderTwigExtension extends AbstractAdminBSBTwigExtension {
24
25
    /**
26
     * Constructor.
27
     */
28
    protected function __construct() {
29
        parent::__construct();
30
    }
31
32
    /**
33
     * Displays an AdminBSB preloader.
34
     *
35
     * @param string $class The class.
36
     * @param string $size The size.
37
     * @return string Returns the AdminBSB preloader.
38
     */
39
    protected function adminBSBPreloader($class, $size) {
40
41
        // Initialize the values.
42
        $sizes = ["xs", "sm", "l", "xl"];
43
44
        // Initialize the attributes.
45
        $attributes = [];
46
47
        $attributes["class"][] = "preloader";
48
        $attributes["class"][] = true === in_array($size, $sizes) ? "pl-size-" . $size : null;
49
50
        // Initialize the parameters.
51
        $content   = "<div class=\"circle-clipper left\"><div class=\"circle\"></div></div><div class=\"circle-clipper right\"><div class=\"circle\"></div></div>";
52
        $innerHTML = self::bootstrapHTMLElement("div", $content, ["class" => ["spinner-layer", $class]]);
0 ignored issues
show
Bug introduced by
The method bootstrapHTMLElement() does not seem to exist on object<WBW\Bundle\AdminB...PreloaderTwigExtension>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
54
        // Return the HTML.
55
        return self::bootstrapHTMLElement("div", $innerHTML, $attributes);
0 ignored issues
show
Bug introduced by
The method bootstrapHTMLElement() does not seem to exist on object<WBW\Bundle\AdminB...PreloaderTwigExtension>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
    }
57
58
}
59