Passed
Push — master ( 00a57d...87b7fa )
by belamov
02:39
created

TimestampRangeCast::parseStringRange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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
26
        return parent::parseStringRange($withoutQuotes);
27
    }
28
}
29