DateTimeTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transform() 0 3 1
A getResourceClass() 0 3 1
1
<?php
2
3
namespace Lneicelis\Transformer\Transformer;
4
5
use Lneicelis\Transformer\Contract\CanTransform;
6
use DateTime;
7
8
class DateTimeTransformer implements CanTransform
9
{
10 4
    public function getResourceClass(): string
11
    {
12 4
        return DateTime::class;
13
    }
14
15
    /**
16
     * @param DateTime $resource
17
     * @return string|int|float|array
18
     */
19 4
    public function transform($resource)
20
    {
21 4
        return $resource->format(DateTime::ISO8601);
22
    }
23
}
24