StringToDateTimeConverter::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Jackal\Copycat\Converter\ValueConverter;
4
5
use DateTime;
6
use Exception;
7
8
/**
9
 * Class StringToDateTimeConverter
10
 * @package Jackal\Copycat\Converter\ValueConverter
11
 */
12
class StringToDateTimeConverter extends AbstractConverter
13
{
14
    /**
15
     * @param $value
16
     * @return mixed
17
     * @throws Exception
18
     */
19
    public function __invoke($value)
20
    {
21
        $value[$this->fieldName] = new DateTime($value[$this->fieldName]);
22
23
        return $value;
24
    }
25
}
26