Completed
Push — master ( 9634df...f1462e )
by Nikola
08:19
created

ClassUtils::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace RunOpenCode\AbstractBuilder\Utils;
4
5
final class ClassUtils
6
{
7
    private function __construct() { /* noop */ }
8
9
    public static function isClassNameValid($fqcn)
10
    {
11
        foreach (explode('\\', ltrim($fqcn, '\\')) as $part) {
12
13
            if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $part)) {
14
                return false;
15
            }
16
        }
17
18
        return true;
19
    }
20
}
21