Completed
Push — master ( a6fe0f...b0c0c1 )
by Sebastian
02:05
created

HeaderValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A asString() 0 4 1
A ensureValue() 0 4 1
1
<?php
2
namespace DjThossi\SmokeTestingPhp\ValueObject;
3
4
use DjThossi\Ensure\EnsureIsStringTrait;
5
6
class HeaderValue
7
{
8
    use EnsureIsStringTrait;
9
10
    const VALUE_IS_NOT_A_STRING = 1;
11
12
    /**
13
     * @var string
14
     */
15
    private $value;
16
17
    /**
18
     * @param string $value
19
     */
20
    public function __construct($value)
21
    {
22
        $this->ensureValue($value);
23
24
        $this->value = $value;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function asString()
31
    {
32
        return $this->value;
33
    }
34
35
    /**
36
     * @param mixed $value
37
     */
38
    private function ensureValue($value)
39
    {
40
        $this->ensureIsString('Value', $value, self::VALUE_IS_NOT_A_STRING);
41
    }
42
}
43