Completed
Push — master ( 15f476...52f8b5 )
by Alex
07:26
created

IntegerRouterType::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php
2
namespace Mezon\Router\Types;
3
4
/**
5
 * Default integer type for router
6
 *
7
 * @author gdever
8
 */
9
class IntegerRouterType
10
{
11
12
    /**
13
     * Method handles integer type
14
     *
15
     * @param string $value
16
     *            value to be parsed
17
     * @return bool was the value parsed
18
     */
19
    public static function handle(string &$value): bool
20
    {
21
        if (is_numeric($value)) {
22
            $value = $value + 0;
23
            return true;
24
        }
25
26
        return false;
27
    }
28
}
29