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

FloatParameter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
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
}