Condition   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 38
ccs 0
cts 27
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A else() 0 4 1
A elseif() 0 3 1
A if() 0 4 1
A endif() 0 8 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*@\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