AbstractStub::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Moka\Stub;
5
6
use Moka\Exception\InvalidArgumentException;
7
use function Moka\Stub\Helper\stripNameAndValidate;
8
9
/**
10
 * Class AbstractStub
11
 * @package Moka\Stub
12
 */
13
abstract class AbstractStub implements StubInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $name;
19
20
    /**
21
     * @var mixed
22
     */
23
    protected $value;
24
25
    /**
26
     * AbstractStub constructor.
27
     * @param string $name
28
     * @param mixed $value
29
     *
30
     * @throws InvalidArgumentException
31
     */
32 87
    public function __construct(string $name, $value)
33
    {
34 87
        $this->name = stripNameAndValidate($name);
35 87
        $this->value = $value;
36
    }
37
38
    /**
39
     * @return string
40
     */
41 82
    public function getName(): string
42
    {
43 82
        return $this->name;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49 82
    public function getValue()
50
    {
51 82
        return $this->value;
52
    }
53
}
54