Conditions | 3 |
Paths | 3 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3.0884 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 3 | public function __construct(AttestationObject $attestationObject) |
|
26 | { |
||
27 | 3 | parent::__construct($attestationObject, self::FORMAT_ID); |
|
28 | |||
29 | 3 | $statement = $attestationObject->getStatement(); |
|
30 | |||
31 | try { |
||
32 | 3 | DataValidator::checkMap( |
|
33 | 3 | $statement, |
|
34 | [ |
||
35 | 3 | 'ver' => 'string', |
|
36 | 'response' => ByteBuffer::class, |
||
37 | ] |
||
38 | ); |
||
39 | } catch (DataValidationException $e) { |
||
40 | throw new ParseException('Invalid Android SafetyNet attestation statement.', 0, $e); |
||
41 | } |
||
42 | |||
43 | 3 | $this->version = $statement->get('ver'); |
|
44 | 3 | if ($this->version === '') { |
|
45 | throw new ParseException('Android SafetyNet version is empty.'); |
||
46 | } |
||
47 | |||
48 | 3 | $res = $statement->get('response'); |
|
49 | 3 | assert($res instanceof ByteBuffer); |
|
50 | 3 | $this->response = $res->getBinaryString(); |
|
51 | 3 | } |
|
63 |