Passed
Push — master ( 637623...02963c )
by Dedipyaman
02:11
created

StringRequired::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of Skletter <https://github.com/2DSharp/Skletter>.
4
 *
5
 * (c) Dedipyaman Das <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Phypes\Type;
12
13
14
use Phypes\Exception\EmptyRequiredValue;
15
16
class StringRequired implements Type
17
{
18
    /**
19
     * @var string $value
20
     */
21
    private $value;
22
23
    /**
24
     * Required constructor.
25
     * @param string $text
26
     * @throws EmptyRequiredValue
27
     */
28
    public function __construct(string $text)
29
    {
30
        if (empty($text))
31
            throw new EmptyRequiredValue();
32
33
        $this->value = $text;
34
    }
35
36
    public function __toString(): string
37
    {
38
        return $this->value;
39
    }
40
41
    public function getValue()
42
    {
43
        return $this->value;
44
    }
45
}