NumRange   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRegexp() 0 4 1
A getSubElement() 0 4 2
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
 * NumRange
14
 *
15
 * Type for numerical ranges.
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 NumRange extends BaseRange
23
{
24
    /**
25
     * getRegexp
26
     *
27
     * @see BaseRange
28
     */
29
    protected function getRegexp()
30
    {
31
        return '/(empty)|([\[\(])(-?[0-9\.]+)?, *(-?[0-9\.]+)?([\]\)])/';
32
    }
33
34
    /**
35
     * getSubElement
36
     *
37
     * @see BaseRange
38
     */
39
    protected function getSubElement($element)
40
    {
41
        return $element !== '' ? $element + 0 : null;
42
    }
43
}
44