AbstractStub   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getValue() 0 4 1
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