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

isName.php ➔ isName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 3
dl 0
loc 12
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Moka\Stub\Helper;
5
6
use Moka\Exception\InvalidArgumentException;
7
8
/**
9
 * @param string $name
10
 * @param string $memberType
11
 * @param string $subject
12
 * @return bool
13
 * @throws InvalidArgumentException
14
 */
15
function isName(string $name, string $memberType, string $subject): bool
16
{
17 93
    validateName(stripName($name));
18
19 92
    return (bool)preg_match(
20 92
        sprintf(
21 92
            TEMPLATE_NAME,
22 92
            PREFIXES[$memberType]
23
        ),
24 92
        $subject
25
    );
26
}
27