Conditions | 5 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
31 | 8 | public function unserialize($encodedValue) |
|
32 | { |
||
33 | try { |
||
34 | 8 | $data = Json::decode($encodedValue, Json::TYPE_ARRAY); |
|
35 | 8 | } catch (RuntimeException $e) { |
|
36 | 2 | throw new InvalidArgumentException($e->getMessage(), 0, $e); |
|
37 | } |
||
38 | |||
39 | 6 | foreach (array('s3BucketName', 's3Key') as $param) { |
|
40 | 6 | if (!array_key_exists($param, $data) || !$data[$param]) { |
|
41 | 2 | throw new InvalidArgumentException(sprintf('Param %s is required and cannot be empty.', $param)); |
|
42 | } |
||
43 | 5 | } |
|
44 | |||
45 | 4 | return new ClaimCheck($data['s3BucketName'], $data['s3Key']); |
|
46 | } |
||
47 | } |
||
48 |