Code Duplication    Length = 15-15 lines in 2 locations

src/BooleanParser.php 1 location

@@ 10-24 (lines=15) @@
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
    public function parse(Source $source)
20
    {
21
        $matched = $source->match('/\Gb:[01];/');
22
        return array(substr($matched, 2, 1) === '1', $source);
23
    }
24
}
25

src/IntegerParser.php 1 location

@@ 10-24 (lines=15) @@
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
    public function parse(Source $source)
20
    {
21
        $matched = $source->match('/\Gi:[+-]?[0-9]+;/');
22
        return array(intval(substr($matched, 2, -1), 10), $source);
23
    }
24
}
25