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

AbstractVariable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
parse() 0 1 ?
A __construct() 0 4 1
A unparsed() 0 4 1
A parsed() 0 8 2
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