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

HeaderValue::asString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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