DateFormatterDayOfYear   A
last analyzed

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
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
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\DateFormatter;
4
5
use Graze\CiffRenderer\DateFormatter\DateFormatterInterface;
6
use DateTimeInterface;
7
8
class DateFormatterDayOfYear implements DateFormatterInterface
9
{
10
    /**
11
     * @param DateTimeInterface $date
12
     * @param string $format
13
     * @return string
14
     */
15 4
    public function format(DateTimeInterface $date, $format)
16
    {
17
        // Clarisoft starts from 1, PHP from 0
18 4
        return (string) ($date->format('z') + 1);
19
    }
20
21
    /**
22
     * @return DateFormatterInterface
23
     */
24 4
    public static function factory()
25
    {
26 4
        return new static();
27
    }
28
}
29