Completed
Pull Request — master (#24)
by X
02:17
created

BooleanParser::isBoolean()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * parser for PHP serialized boolean
4
 */
5
namespace xKerman\Restricted;
6
7
/**
8
 * Parser for PHP serialized boolean
9
 */
10 View Code Duplication
class BooleanParser implements ParserInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
        $matched = $source->match('/\Gb:[01];/');
22 2
        return array(boolval(substr($matched, 2, 1)), $source);
23
    }
24
}
25