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

Condition::else()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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