Passed
Push — master ( 3849b2...6d2bbe )
by Edson
01:17
created

Condition   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 40
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A else() 0 5 1
A elseif() 0 4 1
A __construct() 0 6 1
A if() 0 5 1
A endif() 0 7 1
1
<?php
2
3
namespace Bonfim\Tpl\Tag;
4
5
class Condition extends Tag
6
{
7
    public function __construct()
8
    {
9
        $this->if();
10
        $this->elseif();
11
        $this->else();
12
        $this->endif();
13
    }
14
15
    public function if()
16
    {
17
        self::match('/@\s*if\s*\((.*?)\)/', function($cond) {
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::match() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        self::/** @scrutinizer ignore-call */ 
18
              match('/@\s*if\s*\((.*?)\)/', function($cond) {
Loading history...
18
19
            self::replace("<?php if ($cond) : ?>");
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::replace() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
            self::/** @scrutinizer ignore-call */ 
20
                  replace("<?php if ($cond) : ?>");
Loading history...
20
        });
21
    }
22
23
    public function elseif() {
24
        self::match('/@\s*elseif\s*\((.*?)\)/', function($cond) {
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::match() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        self::/** @scrutinizer ignore-call */ 
25
              match('/@\s*elseif\s*\((.*?)\)/', function($cond) {
Loading history...
25
26
            self::replace("<?php elseif ($cond) : ?>");
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::replace() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
            self::/** @scrutinizer ignore-call */ 
27
                  replace("<?php elseif ($cond) : ?>");
Loading history...
27
        });
28
    }
29
30
    public function else()
31
    {
32
        self::match('/@\s*else/', function () {
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::match() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        self::/** @scrutinizer ignore-call */ 
33
              match('/@\s*else/', function () {
Loading history...
33
34
            self::replace("<?php else : ?>");
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::replace() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
            self::/** @scrutinizer ignore-call */ 
35
                  replace("<?php else : ?>");
Loading history...
35
        });
36
    }
37
38
    public function endif()
39
    {
40
        $regex = '/@\s*\/if/';
41
42
        self::match($regex, function () {
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::match() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        self::/** @scrutinizer ignore-call */ 
43
              match($regex, function () {
Loading history...
43
44
            self::replace("<?php endif ?>");
0 ignored issues
show
Bug Best Practice introduced by
The method Bonfim\Tpl\Tag\Tag::replace() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
            self::/** @scrutinizer ignore-call */ 
45
                  replace("<?php endif ?>");
Loading history...
45
        });
46
    }
47
}
48