Passed
Pull Request — master (#32)
by
unknown
02:09
created

TimestampRangeCast::parseStringRange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Belamov\PostgresRange\Casts;
4
5
use Belamov\PostgresRange\Ranges\TimestampRange;
6
7
class TimestampRangeCast extends RangeCast
8
{
9
    /**
10
     * @param  array  $matches
11
     * @return TimestampRange
12
     */
13
    public function getRangeInstance(array $matches): TimestampRange
14
    {
15
        return new TimestampRange($matches[2], $matches[3], $matches[1], $matches[4]);
16
    }
17
18
    /**
19
     * @param  $value
20
     * @return array
21
     */
22
    protected function parseStringRange($value): array
23
    {
24
        $withoutQuotes = str_replace('"', '', $value);
25
        return parent::parseStringRange($withoutQuotes);
26
    }
27
}
28