Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
57 | private function getUndeleteToken( Title $title ) { |
||
58 | $response = $this->api->postRequest( |
||
59 | new SimpleRequest( |
||
60 | 'query', [ |
||
61 | 'list' => 'deletedrevs', |
||
62 | 'titles' => $title->getTitle(), |
||
63 | 'drprop' => 'token', |
||
64 | ] |
||
65 | ) |
||
66 | ); |
||
67 | if ( array_key_exists( 'token', $response['query']['deletedrevs'][0] ) ) { |
||
68 | return $response['query']['deletedrevs'][0]['token']; |
||
69 | } else { |
||
70 | throw new OutOfBoundsException( |
||
71 | 'Could not get page undelete token from list=deletedrevs query' |
||
72 | ); |
||
73 | } |
||
74 | } |
||
75 | |||
77 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: