Completed
Push — master ( 27e495...3c3313 )
by Edson
02:31
created

Buttons   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
ccs 10
cts 12
cp 0.8333
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A btnCustom() 0 7 1
A btnDefault() 0 7 1
A __construct() 0 4 1
1
<?php
2
3
namespace Sketch\Tpl\Tag;
4
5
class Buttons extends Tag
6
{
7 2
    public function __construct()
8
    {
9 2
        $this->btnDefault();
10 2
        $this->btnCustom();
11 2
    }
12
13 2
    private function btnDefault()
14
    {
15 2
        $regex = "/{(\s?)+btn(\s?)+}(.*?){(\s?)+\/btn(\s?)+}/is";
16
17
        Tag::match($regex, function($value = "") {
18
19
            Tag::replace("<button class=\"btn\">$value</button>");
20 2
        });
21 2
    }
22
23 2
    private function btnCustom()
24
    {
25 2
        $regex = "/{(\s?)+btn(\s?)+[\"'](.*?)[\"'](\s?)+}(.*?){(\s?)+\/btn(\s?)+}/is";
26
27
        Tag::match($regex, function($class = "", $value = "") {
28
29
            Tag::replace("<button class=\"btn btn-$class\">$value</button>");
30 2
        });
31 2
    }
32
}
33