TemplateTag   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 38
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setup() 0 2 1
A getLabel() 0 5 1
A fart() 0 10 3
A getReplacement() 0 3 1
A getTag() 0 2 1
1
<?php
2
/**
3
 * {CLASS SUMMARY}
4
 *
5
 * Date: 7/27/18
6
 * Time: 11:15 PM
7
 * @author Michael Munger <[email protected]>
8
 */
9
10
namespace HPHIO\Farret;
11
12
13
class TemplateTag extends AbstractTag
14
{
15
16 13
    public function getLabel()
17
    {
18 13
        $matches = [];
19 13
        preg_match_all($this->pattern, $this->tag,$matches, PREG_SET_ORDER);
20 13
        return $matches[0][1];
21
    }
22
23 23
    public function setup() {
24 23
        $this->type = AbstractTag::TAG;
0 ignored issues
show
Bug Best Practice introduced by
The property type does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25 23
    }
26
27
//    public function getArgs()
28
//    {
29
//        // TODO: Implement getArgs() method.
30
//    }
31
32 9
    public function fart($dictionary) {
33 9
        $label = $this->getLabel();
34 9
        foreach($dictionary as $find => $replace) {
35 9
            if(strcmp($find,$label) === 0) {
36 8
                $this->replacement = $replace;
37 9
                return true;
38
            }
39
        }
40
41 1
        return false;
42
    }
43
44 3
    public function getTag() {
45 3
        return $this->tag;
46
    }
47
48 9
    public function getReplacement()
49
    {
50 9
        return $this->replacement;
51
    }
52
53
}