Passed
Push — develop ( ec1e42...80559e )
by Brent
03:22
created

AbstractVariable::parsed()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Stitcher\Variable;
4
5
use Stitcher\Parseable;
6
7
abstract class AbstractVariable implements Parseable
8
{
9
    protected $unparsed;
10
    protected $parsed = null;
11
12
    public abstract function parse(): AbstractVariable;
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
13
14 27
    public function __construct($unparsed)
15
    {
16 27
        $this->unparsed = $unparsed;
17 27
    }
18
19
    /**
20
     * @return mixed
21
     */
22
    public function unparsed()
23
    {
24
        return $this->unparsed;
25
    }
26
27
    /**
28
     * @return mixed
29
     */
30 26
    public function parsed()
31
    {
32 26
        if (! $this->parsed) {
33 22
            $this->parse();
34
        }
35
36 26
        return $this->parsed;
37
    }
38
}
39