BoolMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 43
c 0
b 0
f 0
rs 10
ccs 9
cts 9
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 3 1
A slumber() 0 3 1
A __construct() 0 3 1
A awake() 0 3 1
1
<?php
2
/**
3
 * File was created 30.09.2015 07:58
4
 */
5
6
namespace PeekAndPoke\Component\Slumber\Core\Codec\Property;
7
8
use PeekAndPoke\Component\Slumber\Annotation\Slumber\AsBool;
9
use PeekAndPoke\Component\Slumber\Core\Codec\Awaker;
10
use PeekAndPoke\Component\Slumber\Core\Codec\Slumberer;
11
12
/**
13
 * @author Karsten J. Gerber <[email protected]>
14
 */
15
class BoolMapper extends AbstractPropertyMapper
16
{
17
    /** @var AsBool */
18
    private $options;
19
20
    /**
21
     * C'tor.
22
     *
23
     * @param AsBool $options
24
     */
25 23
    public function __construct(AsBool $options)
26
    {
27 23
        $this->options = $options;
28 23
    }
29
30
    /**
31
     * @return AsBool
32
     */
33 1
    public function getOptions()
34
    {
35 1
        return $this->options;
36
    }
37
38
    /**
39
     * @param Slumberer $slumberer
40
     * @param mixed     $value
41
     *
42
     * @return bool
43
     */
44 11
    public function slumber(Slumberer $slumberer, $value)
45
    {
46 11
        return (bool) $value;
47
    }
48
49
    /**
50
     * @param Awaker $awaker
51
     * @param mixed  $value
52
     *
53
     * @return bool
54
     */
55 10
    public function awake(Awaker $awaker, $value)
56
    {
57 10
        return (bool) $value;
58
    }
59
}
60