Completed
Pull Request — master (#44)
by Alberto
02:53
created

buildStub.php ➔ buildStub()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Moka\Factory;
5
6
use function Moka\Stub\Helper\isPropertyName;
7
use Moka\Stub\MethodStub;
8
use Moka\Stub\PropertyStub;
9
use Moka\Stub\StubInterface;
10
11
/**
12
 * @param string $name
13
 * @param mixed $value
14
 * @return StubInterface
15
 */
16
function buildStub(string $name, $value): StubInterface
17
{
18 80
    return isPropertyName($name)
19 80
        ? new PropertyStub($name, $value)
20 80
        : new MethodStub($name, $value);
21
}
22