Completed
Push — master ( fd3130...674c45 )
by John
03:39
created

DateFormatterDayOfYear   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A format() 0 4 1
A factory() 0 3 1
1
<?php
2
3
namespace Graze\CiffRenderer\Parser\FieldParser\DateFormatter;
4
5
use Graze\CiffRenderer\Parser\FieldParser\DateFormatter\DateFormatterInterface;
6
7
class DateFormatterDayOfYear implements DateFormatterInterface
8
{
9
    /**
10
     * @param \DateTimeInterface $date
11
     * @param string $format
12
     * @return string
13
     */
14 1
    public function format(\DateTimeInterface $date, $format)
15
    {
16
        // Clarisoft starts from 1, PHP from 0
17 1
        return (string) ($date->format('z') + 1);
18
    }
19
20
    /**
21
     * @return DateFormatterInterface
22
     */
23 1
    public static function factory()
24
    {
25 1
        return new static();
26
    }
27
}
28