Section::name()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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