Passed
Push — master ( b5ed04...e01758 )
by Baptiste
10:04
created

Assert   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A notRegex() 0 11 3
1
<?php
2
namespace Behapi\Tools;
3
4
use Webmozart\Assert\Assert as webmozart;
5
6
/**
7
 * Assert
8
 *
9
 * Use while https://github.com/webmozart/assert/pull/58 isn't merged
10
 *
11
 * @method static void nullOrNotRegx($value, $pattern, $message = '')
12
 * @method static void allNotRegex($values, $pattern, $message = '')
13
 */
14
final class Assert extends webmozart
15
{
16
    public static function notRegex($value, $pattern, $message = '')
17
    {
18
        if (!preg_match($pattern, $value)) {
19
            return;
20
        }
21
22
        static::reportInvalidArgument(sprintf(
23
            $message ?: 'Expected a value to not match %s',
24
            static::valueToString($pattern)
25
        ));
26
    }
27
}
28