Key   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 40
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fromString() 0 4 1
A key() 0 4 1
A guard() 0 5 1
A setKey() 0 4 1
1
<?php
2
3
namespace Galileo\SettingBundle\Lib\Model\ValueObject;
4
5
use Galileo\SettingBundle\Lib\Model\Exceptions\GuardException;
6
use Galileo\SettingBundle\Lib\Model\Specification\AlphaNumericSpecification;
7
8
class Key
9
{
10
    private $key;
11
12
    /**
13
     * @throws GuardException
14
     */
15 8
    public function __construct($key)
16
    {
17 8
        $this->guard($key);
18 8
        $this->setKey($key);
19 8
    }
20
21 2
    public static function fromString($keyName)
22
    {
23 2
        return new Key($keyName);
24
    }
25
26 8
    public function key()
27
    {
28 8
        return $this->key;
29
    }
30
31
    /**
32
     * @param $key
33
     */
34 8
    private function guard($key)
35
    {
36 8
        $alphaNumericSpecification = new AlphaNumericSpecification();
37 8
        $alphaNumericSpecification->guard($key);
38 8
    }
39
40
    /**
41
     * @param $key
42
     */
43 8
    private function setKey($key)
44
    {
45 8
        $this->key = $key;
46 8
    }
47
}
48