Completed
Push — master ( 7ee214...32fd8d )
by Alberto
19s
created

PropertyStub   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Moka\Stub;
5
6
use Moka\Exception\InvalidArgumentException;
7
8
/**
9
 * Class PropertyStub
10
 * @package Moka\Stub
11
 */
12
class PropertyStub extends AbstractStub
13
{
14
    /**
15
     * PropertyStub constructor.
16
     * @param string $name
17
     * @param mixed $value
18
     *
19
     * @throws InvalidArgumentException
20
     */
21 10
    public function __construct(string $name, $value)
22
    {
23 10
        if (static::PREFIX_PROPERTY !== $name[0]) {
24 2
            throw new InvalidArgumentException(
25 2
                sprintf(
26 2
                    'Name must be prefixed by "%s", "%s" given',
27 2
                    StubInterface::PREFIX_PROPERTY,
28 2
                    $name
29
                )
30
            );
31
        }
32
33 8
        parent::__construct(substr($name, 1), $value);
34
    }
35
}
36