IsDateRegex   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkValue() 0 3 1
1
<?php
2
3
namespace kalanis\kw_rules\Rules\External;
4
5
6
use kalanis\kw_rules\Rules\MatchesPattern;
7
8
9
/**
10
 * Class IsDateRegex
11
 * @package kalanis\kw_rules\Rules\External
12
 * Check if input is date for preset format (YYYY-MM-DD)
13
 * @codeCoverageIgnore when I wrote tests I have zero will for defining all available dates to check
14
 */
15
class IsDateRegex extends MatchesPattern
16
{
17
    protected function checkValue(/** @scrutinizer ignore-unused */ $againstValue)
18
    {
19
        return '/^(((\d{4})(-)(0[13578]|10|12)(-)(0[1-9]|[12][0-9]|3[01]))|((\d{4})(-)(0[469]|11)(-)([0][1-9]|[12][0-9]|30))|((\d{4})(-)(02)(-)(0[1-9]|1[0-9]|2[0-8]))|(([02468][048]00)(-)(02)(-)(29))|(([13579][26]00)(-)(02)(-)(29))|(([0-9][0-9][0][48])(-)(02)(-)(29))|(([0-9][0-9][2468][048])(-)(02)(-)(29))|(([0-9][0-9][13579][26])(-)(02)(-)(29)))$/iu';
20
    }
21
}
22