Skip to content

Commit

Permalink
Move comment
Browse files Browse the repository at this point in the history
  • Loading branch information
PjoeterBliep committed Sep 24, 2024
1 parent 7519522 commit 222dc87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RSHiScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ private static function escapeStrings( $arrayOrString ) {
* @throws Exception If $skill or $type could not be found, or if endpoint returned unexpected results
*/
private static function getSingleSkillData( $data, $skill, $type, $fromInt ) {
// Case-insensitive, use same processing as self::postFetch did
if ( $fromInt ) {
if ( (int) $skill >= count($data) ) {
throw new Exception( wfMessage( 'rshiscores-error-unknown-skill' ) );
}
// Semi-backwards compatibility: If skill is integer "n", take the "n"th element of the data.
$skill = array_keys( $data )[ $skill ];
} else {
// Case-insensitive, use same processing as self::postFetch did
$skill = self::escapeStrings( strtolower( $skill ) );
}
if ( !isset( $data[ $skill ] ) ) {
Expand Down

0 comments on commit 222dc87

Please sign in to comment.