Loop::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bonfim\Tpl\Tag;
4
5
class Loop extends Tag
6
{
7
    public function __construct()
8
    {
9
        $this->foreach();
10
        $this->endforeach();
11
12
        $this->for();
13
        $this->endfor();
14
    }
15
16
    private function for()
17
    {
18
        self::match('/\s*@\s*for\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

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

25
        self::/** @scrutinizer ignore-call */ 
26
              match('/@\s*\/for/', function () {
Loading history...
26
            self::replace("<?php endfor ?>");
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 endfor ?>");
Loading history...
27
        });
28
    }
29
30
    private function foreach()
31
    {
32
        self::match('/\s*@\s*foreach\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

32
        self::/** @scrutinizer ignore-call */ 
33
              match('/\s*@\s*foreach\s*\((.*?)\)\s*$/m', function ($cond) {
Loading history...
33
            self::replace("<?php foreach ($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

33
            self::/** @scrutinizer ignore-call */ 
34
                  replace("<?php foreach ($cond) : ?>");
Loading history...
34
        });
35
    }
36
37
    private function endforeach()
38
    {
39
        self::match('/@\s*\/foreach/', 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

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

40
            self::/** @scrutinizer ignore-call */ 
41
                  replace("<?php endforeach ?>");
Loading history...
41
        });
42
43
        self::match('/@\s*endforeach/', function () {
44
            self::replace("<?php endforeach ?>");
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 endforeach ?>");
Loading history...
45
        });
46
    }
47
}
48