FollowRedirect::asBoolean()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace DjThossi\SmokeTestingPhp\ValueObject;
3
4
use DjThossi\Ensure\EnsureIsBooleanTrait;
5
6
class FollowRedirect
7
{
8
    use EnsureIsBooleanTrait;
9
10
    const FOLLOW_IS_NOT_A_BOOLEAN = 1;
11
12
    /**
13
     * @var bool
14
     */
15
    private $follow;
16
17
    /**
18
     * @param bool $follow
19
     */
20
    public function __construct($follow)
21
    {
22
        $this->ensureFollow($follow);
23
24
        $this->follow = $follow;
25
    }
26
27
    /**
28
     * @return bool
29
     */
30
    public function asBoolean()
31
    {
32
        return $this->follow;
33
    }
34
35
    /**
36
     * @param mixed $follow
37
     */
38
    private function ensureFollow($follow)
39
    {
40
        $this->ensureIsBoolean('Follow', $follow, self::FOLLOW_IS_NOT_A_BOOLEAN);
41
    }
42
}
43