Code Duplication    Length = 12-12 lines in 2 locations

src/Type/Scalar/DateTimeType.php 1 location

@@ 26-37 (lines=12) @@
23
        return 'DateTime';
24
    }
25
26
    public function isValidValue($value)
27
    {
28
        if ((is_object($value) && $value instanceof \DateTimeInterface) || is_null($value)) {
29
            return true;
30
        } else if (is_string($value)) {
31
            $date = $this->createFromFormat($value);
32
        } else {
33
            $date = null;
34
        }
35
36
        return $date ? true : false;
37
    }
38
39
    public function serialize($value)
40
    {

src/Type/Scalar/DateTimeTzType.php 1 location

@@ 19-30 (lines=12) @@
16
    {
17
        return 'DateTimeTz';
18
    }
19
    public function isValidValue($value)
20
    {
21
        if ((is_object($value) && $value instanceof \DateTimeInterface) || is_null($value)) {
22
            return true;
23
        } else if (is_string($value)) {
24
            $date = $this->createFromFormat($value);
25
        } else {
26
            $date = null;
27
        }
28
29
        return $date ? true : false;
30
    }
31
32
    public function serialize($value)
33
    {