Completed
Push — master ( 461ffe...a27db3 )
by João Felipe Magro
12:47
created

DateUtil::isValid()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
namespace Ipag\Classes\Util;
4
5
final class DateUtil
6
{
7
    public function isValid($date)
8
    {
9
        if (preg_match("/([0-9]{2})\/([0-9]{2})\/([0-9]{4})/", $date, $matches)) {
10
            if (checkdate($matches[2], $matches[1], $matches[3])) {
11
                return true;
12
            }
13
        }
14
15
        return false;
16
    }
17
}
18