Section   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 44
ccs 15
cts 15
cp 1
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 8
    public function __construct($name)
20
    {
21 8
        $this->guard($name);
22 8
        $this->setName($name);
23 8
    }
24
25 8
    public static function blank()
26
    {
27 8
        return new Section(Section::EMPTY_SECTION);
28
    }
29
30 8
    public function name()
31
    {
32 8
        return $this->name;
33
    }
34
35
    /**
36
     * @param $name
37
     */
38 8
    private function setName($name)
39
    {
40 8
        $this->name = $name;
41 8
    }
42
43
    /**
44
     * @param $name
45
     */
46 8
    private function guard($name)
47
    {
48 8
        $alphaNumericSpecification = new AlphaNumericSpecification();
49 8
        $alphaNumericSpecification->guard($name);
50 8
    }
51
}
52