Test Failed
Branch master (fb3e9d)
by 世昌
03:53
created

FloatParameter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMatch() 0 2 1
A __construct() 0 2 1
A getValue() 0 2 1
1
<?php
2
namespace nebula\route\uri\parameter;
3
4
use nebula\route\uri\parameter\Parameter;
5
6
/**
7
 * 匹配float参数
8
 */
9
class FloatParameter extends Parameter {
10
11
    protected static $name = 'float';
12
13
14
    public function __construct(string $extra) {
15
        $this->default = floatval($this->getCommonDefault($extra));
16
    }
17
 
18
    public function getValue(string $matched) {
19
        return floatval($matched);
20
    }
21
22
    /**
23
     * 获取匹配字符串
24
     *
25
     * @return string
26
     */
27
    function getMatch():string {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
        return '(\d+\.\d+)';
29
    }
30
}