Passed
Push — master ( cb7318...f55ee1 )
by Radu
01:55
created

Utils::arrayKey()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace WebServCo\Framework;
3
4
final class Utils
5
{
6
    public static function arrayKey($key, $array, $defaultValue = false)
7
    {
8
        return array_key_exists($key, $array) ? $array[$key] : $defaultValue;
9
    }
10
11
    public static function isDate(string $date, $format = 'Y-m-d')
12
    {
13
        $dateTime = \DateTime::createFromFormat($format, $date);
14
        return $dateTime && $dateTime->format($format) == $date;
15
    }
16
}
17