Completed
Push — master ( 982f0c...377cb6 )
by Kamil
05:13 queued 02:16
created

Section   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 44
ccs 0
cts 22
cp 0
rs 10
c 1
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A blank() 0 4 1
A name() 0 4 1
A setName() 0 4 1
A guard() 0 5 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 Section
9
{
10
    const EMPTY_SECTION = '___empty_section___';
11
12
    private $name;
13
14
    /**
15
     * @param string $name
16
     *
17
     * @throws GuardException
18
     */
19
    public function __construct($name)
20
    {
21
        $this->guard($name);
22
        $this->setName($name);
23
    }
24
25
    public static function blank()
26
    {
27
        return new Section(Section::EMPTY_SECTION);
28
    }
29
30
    public function name()
31
    {
32
        return $this->name;
33
    }
34
35
    /**
36
     * @param $name
37
     */
38
    private function setName($name)
39
    {
40
        $this->name = $name;
41
    }
42
43
    /**
44
     * @param $name
45
     */
46
    private function guard($name)
47
    {
48
        $alphaNumericSpecification = new AlphaNumericSpecification();
49
        $alphaNumericSpecification->guard($name);
50
    }
51
}
52