UuidValidator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace hiapi\validators;
4
5
use yii\validators\RegularExpressionValidator;
6
7
/**
8
 * Class UuidValidator
9
 *
10
 * @author Dmytro Naumenko <[email protected]>
11
 */
12
class UuidValidator extends RegularExpressionValidator
13
{
14
    public $pattern = '/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i';
15
16
    public function __construct($config = [])
17
    {
18
        parent::__construct($config);
19
20
        $this->message = '{attribute} must be a valid UUID';
21
    }
22
}
23