Completed
Pull Request — master (#162)
by personal
05:46 queued 03:11
created

ReflectedReturn::setMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Component\OOP\Reflected;
11
use Hal\Component\OOP\Resolver\NameResolver;
12
13
14
/**
15
 * represents the value returned by a method
16
 *
17
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
18
 */
19
class ReflectedReturn {
20
21
    const STRICT_TYPE_HINT = 1;
22
    const DOC_TYPE_HINT = 2;
23
    const ESTIMATED_TYPE_HINT = 3;
24
    const VALUE_UNKNOW = 'unknown';
25
26
    /**
27
     * @var string
28
     */
29
    private $value = self::VALUE_UNKNOW;
30
31
    /**
32
     * @var string
33
     */
34
    private $type;
35
36
    /**
37
     * @var int
38
     */
39
    private $mode = self::ESTIMATED_TYPE_HINT;
40
41
    /**
42
     * @param null $type
43
     * @param string $value
44
     * @param int $mode
45
     */
46
    public function __construct($type = null, $value = self::VALUE_UNKNOW, $mode = self::ESTIMATED_TYPE_HINT)
47
    {
48
        $this->type = $type;
49
        $this->value = $value;
50
        $this->mode = $mode;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getValue()
57
    {
58
        return $this->value;
59
    }
60
61
    /**
62
     * @param string $value
63
     * @return ReflectedReturn
64
     */
65
    public function setValue($value)
66
    {
67
        $this->value = $value;
68
        return $this;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getType()
75
    {
76
        return $this->type;
77
    }
78
79
    /**
80
     * @param string $type
81
     * @return ReflectedReturn
82
     */
83
    public function setType($type)
84
    {
85
        $this->type = $type;
86
        return $this;
87
    }
88
89
    /**
90
     * @return int
91
     */
92
    public function getMode()
93
    {
94
        return $this->mode;
95
    }
96
97
    /**
98
     * @param int $mode
99
     * @return ReflectedReturn
100
     */
101
    public function setMode($mode)
102
    {
103
        $this->mode = $mode;
104
        return $this;
105
    }
106
107
};