Completed
Push — master ( fe4c2e...b05117 )
by Michael
12s
created

Calendar   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 87.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 29
rs 10
ccs 7
cts 8
cp 0.875

1 Method

Rating   Name   Duplication   Size   Complexity  
A decodeYear() 0 16 4
1
<?php
2
3
namespace Xoops\Core\Locale\Punic;
4
5
/**
6
 * Overrides for Punic\Calendar.
7
 */
8
class Calendar extends \Punic\Calendar
9
{
10
    /**
11
     * Change to disable interpreteting 'yy' as forcing 2 digit year
12
     *
13
     * Instead of interpreting 2015 as '15' it will be '2015', while year 1 would be reported as '01'
14
     *
15
     * @param \DateTime $value
16
     * @param           $count
17
     * @param           $locale
18
     * @return string
19
     */
20 12
    protected static function decodeYear(\DateTime $value, $count, $locale)
21
    {
22
        switch ($count) {
23 12
            case 1:
24 10
                return strval(intval($value->format('Y')));
25 2
            case 2:
26
                //return $value->format('y');
27
            default:
28 2
                $s = $value->format('Y');
29 2
                if (!isset($s[$count])) {
30
                    $s = str_pad($s, $count, '0', STR_PAD_LEFT);
31
                }
32
33 2
                return $s;
34
        }
35
    }
36
}
37