Completed
Pull Request — development (#673)
by Nick
12:54 queued 04:44
created

DateUtil   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A dateTimeFromMySqlFormat() 0 4 1
1
<?php
2
3
namespace Oc\Util;
4
5
use DateTime;
6
7
class DateUtil
8
{
9
    const DATE_FORMAT_MYSQL = 'Y-m-d H:i:s';
10
11
    /**
12
     * @param string $date
13
     *
14
     * @return \DateTime
15
     */
16
    public static function dateTimeFromMySqlFormat($date)
17
    {
18
        return DateTime::createFromFormat(self::DATE_FORMAT_MYSQL, $date);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression \DateTime::createFromFor...E_FORMAT_MYSQL, $date); of type DateTime|false adds false to the return on line 18 which is incompatible with the return type documented by Oc\Util\DateUtil::dateTimeFromMySqlFormat of type DateTime. It seems like you forgot to handle an error condition.
Loading history...
19
    }
20
}
21