Completed
Pull Request — master (#44)
by Angelo
07:41
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 Moka\Exception\InvalidArgumentException;
7
use Moka\Stub\MethodStub;
8
use Moka\Stub\PropertyStub;
9
use Moka\Stub\StubHelper;
10
use Moka\Stub\StubInterface;
11
12
/**
13
 * @param string $name
14
 * @param mixed $value
15
 * @return StubInterface
16
 */
17
function buildStub(string $name, $value): StubInterface
18
{
19 80
    return StubHelper::isPropertyName($name)
20 80
        ? new PropertyStub($name, $value)
21 80
        : new MethodStub($name, $value);
22
}
23