Completed
Pull Request — 2.0 (#75)
by Julien
02:32
created

TsRange   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRegexp() 0 4 1
A getSubElement() 0 4 1
1
<?php
2
/*
3
 * This file is part of PommProject's Foundation package.
4
 *
5
 * (c) 2014 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\Foundation\Converter\Type;
11
12
/**
13
 * TsRange
14
 *
15
 * Type for range of timestamps.
16
 *
17
 * @package Foundation
18
 * @copyright 2014 Grégoire HUBERT
19
 * @author Grégoire HUBERT
20
 * @license X11 {@link http://opensource.org/licenses/mit-license.php}
21
 */
22
class TsRange extends BaseRange
23
{
24
    /**
25
     * getRegexp
26
     *
27
     * @see BaseRange
28
     */
29
    protected function getRegexp()
30
    {
31
        return '/([\[\(])"?([0-9 :+\.-]+)"?, *"?([0-9 :+\.-]+)"?([\]\)])/';
32
    }
33
34
    /**
35
     * getSubElement
36
     *
37
     * @see BaseRange
38
     */
39
    protected function getSubElement($element)
40
    {
41
        return new \DateTime($element);
42
    }
43
}
44