Completed
Pull Request — master (#19)
by John
04:27
created

DateFormatterBasic::format()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Graze\CiffRenderer\Parser\FieldParser\FieldParserDate\DateFormatter;
4
5
use Graze\CiffRenderer\Parser\FieldParser\FieldParserDate\DateFormatter\DateFormatterInterface;
6
use Urbanplum\DotnetDateTime\DotnetDateTime;
7
8
class DateFormatterBasic implements DateFormatterInterface
9
{
10
    /**
11
     * @param \DateTimeInterface $date
12
     * @param string $format
13
     * @return string
14
     */
15
    public function format(\DateTimeInterface $date, $format)
16
    {
17
        $dotnetDateTime = new DotnetDateTime();
18
        $phpFormat = $dotnetDateTime->formatToPhp($format);
19
20
        return (string) $date->format($phpFormat);
21
    }
22
}
23