BootstrapWidgets   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 1
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A getWidget() 0 3 1
1
<?php
2
namespace Mezon\Gui\WidgetsRegistry;
3
4
/**
5
 * Class BootstrapWidgets
6
 *
7
 * @package WidgetsRegistry
8
 * @subpackage BootstrapWidgets
9
 * @author Dodonov A.A.
10
 * @version v.1.0 (2019/09/02)
11
 * @copyright Copyright (c) 2019, http://aeon.su
12
 */
13
14
/**
15
 * Bootstrap widgets
16
 */
17
class BootstrapWidgets implements WidgetsRegistryBase
18
{
19
20
    /**
21
     * Method returns widget
22
     *
23
     * @param string $name
24
     *            name of the widget
25
     * @return string widget's HTML code
26
     */
27
    public function getWidget(string $name): string
28
    {
29
        return BootstrapWidgets::get($name);
30
    }
31
32
    /**
33
     * Method returns widget
34
     *
35
     * @param string $name
36
     *            name of the widget
37
     * @return string widget's HTML code
38
     */
39
    public static function get(string $name): string
40
    {
41
        return file_get_contents(__DIR__ . '/res/templates/' . $name . '.tpl');
42
    }
43
}
44