MobileVN::pregFormat()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
rs 9.8666
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/phpviet/validation
4
 *
5
 * @copyright (c) PHP Viet
6
 * @license [MIT](https://opensource.org/licenses/MIT)
7
 */
8
9
namespace PHPViet\Validation\Rules;
10
11
/**
12
 * @author Vuong Minh <[email protected]>
13
 * @since 1.0.0
14
 */
15
class MobileVN extends AbstractStaticRegexRule
16
{
17
    public static function pregFormat(): string
18
    {
19
        return strtr('~^(\+?84|0)(::head::)\d{7}$~', [
20
            '::head::' => implode('|', [
21
                '3[2-9]',
22
                '5[2689]',
23
                '7[06-9]',
24
                '8[1-9]',
25
                '9[0-9]',
26
            ]),
27
        ]);
28
    }
29
}
30