Completed
Push — master ( ac4bb0...098b56 )
by Stéphane
02:42
created

FormatDate::format()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 2
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
1
<?php namespace Todaymade\Daux;
2
3
use IntlDateFormatter;
4
5
class FormatDate
6
{
7
    public static function format($params, $date) {
8
        $locale = $params['language'];
9
        $datetype = IntlDateFormatter::LONG;
10
        $timetype = IntlDateFormatter::SHORT;
11
        $timezone = null;
12
13
        if (!extension_loaded("intl")) {
14
            $locale = 'en';
15
            $timezone = 'GMT';
16
        }
17
18
        $formatter = new IntlDateFormatter($locale, $datetype, $timetype, $timezone);
19
20
        return $formatter->format($date);
21
    }
22
}