Condition::else()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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 4
ccs 0
cts 3
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*@\s*if\s*\((.*?)\)\s*$/m', 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*@\s*if\s*\((.*?)\)\s*$/m', function($cond) {
Loading history...
18
            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

18
            self::/** @scrutinizer ignore-call */ 
19
                  replace("<?php if ($cond) : ?>");
Loading history...
19
        });
20
    }
21
22
    public function elseif() {
23
        self::match('/\s*@\s*elseif\s*\((.*?)\)\s*$/m', 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

23
        self::/** @scrutinizer ignore-call */ 
24
              match('/\s*@\s*elseif\s*\((.*?)\)\s*$/m', function($cond) {
Loading history...
24
            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

24
            self::/** @scrutinizer ignore-call */ 
25
                  replace("<?php elseif ($cond) : ?>");
Loading history...
25
        });
26
    }
27
28
    public function else()
29
    {
30
        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

30
        self::/** @scrutinizer ignore-call */ 
31
              match('/@\s*else/', function () {
Loading history...
31
            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

31
            self::/** @scrutinizer ignore-call */ 
32
                  replace("<?php else : ?>");
Loading history...
32
        });
33
    }
34
35
    public function endif()
36
    {
37
        self::match('/@\s*\/if/', 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

37
        self::/** @scrutinizer ignore-call */ 
38
              match('/@\s*\/if/', function () {
Loading history...
38
            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

38
            self::/** @scrutinizer ignore-call */ 
39
                  replace("<?php endif ?>");
Loading history...
39
        });
40
41
        self::match('/@\s*endif/', function () {
42
            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

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