Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public static function ensureInputDataAreValid(GrantType $grantType, TokenRequestAttempt $tokenRequestAttempt) |
||
24 | { |
||
25 | $inputDataKeys = $tokenRequestAttempt->getInputData()->all(); |
||
26 | |||
27 | // check if we got the actual input data or just its keys |
||
28 | if (array_keys($tokenRequestAttempt->getInputData()->all()) !== range(0, count($tokenRequestAttempt->getInputData()->all()) - 1)) { |
||
29 | |||
30 | $inputDataKeys = array_keys($tokenRequestAttempt->getInputData()->all()); |
||
31 | } |
||
32 | |||
33 | // using != instead of !== does not check the order of the properties |
||
34 | if ($grantType->getRequiredInputData() != array_values(array_intersect($inputDataKeys, $grantType->getRequiredInputData()))) { |
||
35 | |||
36 | throw new MissingOrInvalidInputData($grantType->getIdentifier(), $inputDataKeys, $grantType->getRequiredInputData()); |
||
37 | } |
||
38 | } |
||
39 | } |
||
40 |