Passed
Push — master ( ea07e6...0cfd65 )
by X
32s
created

BooleanParser::parse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 3
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
1
<?php
2
/**
3
 * parser for PHP serialized boolean
4
 */
5
namespace xKerman\Restricted;
6
7
/**
8
 * Parser for PHP serialized boolean
9
 */
10
class BooleanParser implements ParserInterface
11
{
12
    /**
13
     * parse given `$source` as PHP serialized boolean
14
     *
15
     * @param Source $source parser input
16
     * @return array
17
     * @throws UnserializeFailedException
18
     */
19 8
    public function parse(Source $source)
20
    {
21 8
        $result = $source->match('/\Gb:([01]);/');
22 2
        return array((boolean)$result, $source);
23
    }
24
}
25