unserialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * provide `unserialize` function that is safe for PHP Object Injection
4
 */
5
namespace xKerman\Restricted;
6
7
/**
8
 * parse serialized string and return result
9
 *
10
 * @param string $str serialized string
11
 * @return mixed
12
 * @throws UnserializeFailedException
13
 */
14
function unserialize($str)
15
{
16 107
    $source = new Source($str);
17 107
    $parser = new ExpressionParser();
18 107
    list($result,) = $parser->parse($source);
19 41
    return $result;
20
}
21