Completed
Push — master ( 8cac34...b87516 )
by Viacheslav
07:08 queued 03:36
created

State   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
lcom 2
cbo 2
dl 0
loc 40
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setIo() 0 5 1
A makeAnchor() 0 4 1
A __get() 0 4 2
A __set() 0 4 1
A hasProperty() 0 4 1
A export() 0 4 1
1
<?php
2
3
namespace Yaoi\Command;
4
5
use Yaoi\BaseClass;
6
7
class State extends BaseClass
8
{
9
    public $commandClass;
10
    private $properties = array();
11
    /** @var Io */
12
    private $io;
13
14
    public function setIo(Io $io = null)
15
    {
16
        $this->io = $io;
17
        return $this;
18
    }
19
20
    public function makeAnchor()
21
    {
22
        return $this->io->makeAnchor($this);
23
    }
24
25
    public function __get($name)
26
    {
27
        return isset($this->properties[$name]) ? $this->properties[$name] : null;
28
    }
29
30
    public function __set($name, $value)
31
    {
32
        $this->properties[$name] = $value;
33
    }
34
35
    public function hasProperty($name)
36
    {
37
        return array_key_exists($name, $this->properties);
38
    }
39
40
41
    public function export()
42
    {
43
        return $this->properties;
44
    }
45
46
}