DateTimeTransformer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 14 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Component\Input\Transformer;
6
7
class DateTimeTransformer implements TransformerInterface
8
{
9
    public function transform($value)
10
    {
11
        if ($value === null) {
12
            return;
13
        }
14
15
        try {
16
            $date = new \DateTime($value);
17
        } catch (\Exception $e) {
18
            return;
19
        }
20
21
        return $date;
22
    }
23
}
24