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

FormatDate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A format() 0 14 2
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
}