Completed
Push — master ( 581a9c...240c2a )
by Nikola
02:24
created

PreReleaseIdentifier::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
/**
4
 * This file is part of the Version package.
5
 *
6
 * Copyright (c) Nikola Posa <[email protected]>
7
 *
8
 * For full copyright and license information, please refer to the LICENSE file,
9
 * located at the package root folder.
10
 */
11
12
namespace Version\Identifier;
13
14
use Version\Exception\InvalidIdentifierValueException;
15
16
/**
17
 * @author Nikola Posa <[email protected]>
18
 */
19
final class PreReleaseIdentifier extends BaseIdentifier
20
{
21 41
    protected static function validate($value)
22
    {
23 41
        if (!preg_match('/^[0-9A-Za-z\-]+$/', $value)) {
24 1
            throw new InvalidIdentifierValueException(__CLASS__ . ' value must contain only alphanumerics and hyphen');
25
        }
26 40
    }
27
}
28