SchemeName::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
3
namespace ValueObjects\Web;
4
5
use ValueObjects\Exception\InvalidNativeArgumentException;
6
use ValueObjects\StringLiteral\StringLiteral;
7
8
class SchemeName extends StringLiteral
9
{
10
    /**
11
     * Returns a SchemeName
12
     *
13
     * @param string $value
14
     */
15 15
    public function __construct($value)
16
    {
17 15
        if (0 === \preg_match('/^[a-z]([a-z0-9\+\.-]+)?$/i', $value)) {
18 1
            throw new InvalidNativeArgumentException($value, array('string (valid scheme name)'));
19
        }
20
21 14
        $this->value = $value;
22 14
    }
23
}
24