Passed
Push — master ( 045368...64d8f0 )
by X
30s
created

IntegerParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10
c 2
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 5 1
1
<?php
2
/**
3
 * parser for PHP serialized integer
4
 */
5
namespace xKerman\Restricted;
6
7
/**
8
 * Parser for PHP serialized integer
9
 */
10
class IntegerParser implements ParserInterface
11
{
12
    /**
13
     * parse given `$source` as PHP serialized integer
14
     *
15
     * @param Source $source parser input
16
     * @return array
17
     * @throws UnserializeFailedException
18
     */
19 17
    public function parse(Source $source)
20
    {
21 17
        $result = intval($source->match('/\Gi:([+-]?[0-9]+);/'), 10);
22 7
        return array($result, $source);
23
    }
24
}
25