Completed
Push — master ( 934009...eebb8a )
by Peter
01:53
created

Assert   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

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
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A date() 0 11 3
1
<?php
2
3
namespace PtrTn\Battlerite\Assert;
4
5
use DateTime;
6
use Webmozart\Assert\Assert as BaseAssert;
7
8
class Assert extends BaseAssert
9
{
10 7
    public static function date($value, $format, $message = '')
11
    {
12 7
        $date = DateTime::createFromFormat($format, $value);
13 7
        if ($date === false) {
14 1
            static::reportInvalidArgument(sprintf(
15 1
                $message ?: 'Expected a valid date in format %s. Got: %s',
16 1
                $format,
17 1
                $value
18
            ));
19
        }
20 6
    }
21
}
22