Skip to content

Commit

Permalink
Fixing PHP 7.4 notices
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjasoturi committed Jul 8, 2021
1 parent 8ae9ca2 commit 42ec093
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion logic/get_local_pokemon_name.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function get_local_pokemon_name($pokemon_id, $pokemon_form_id, $override_languag
{
$q = my_query("SELECT pokemon_name, pokemon_form_name FROM pokemon WHERE pokedex_id = '{$pokemon_id}' AND pokemon_form_id = '{$pokemon_form_id}'");
$res = $q->fetch();
$pokemon_form_name = $res['pokemon_form_name'];
$pokemon_form_name = $res['pokemon_form_name'] ?? 'normal';

debug_log('Pokemon_form: ' . $pokemon_form_name);

Expand Down
71 changes: 36 additions & 35 deletions logic/get_pokemon_form_name.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
<?php
/**
* Get pokemon form name.
* @param $pokedex_id
* @param $pokemon_form_id
* @return string
*/
function get_pokemon_form_name($pokedex_id, $pokemon_form_id)
{
debug_log($pokedex_id.'-'.$pokemon_form_id, 'Finding Pokemon form name for:');

// Make sure $dex_id is numeric
if(is_numeric($pokedex_id) && is_numeric($pokemon_form_id)) {
// Get raid level from database
$rs = my_query(
"
SELECT pokemon_form_name
FROM pokemon
WHERE pokedex_id = {$pokedex_id}
AND pokemon_form_id = '{$pokemon_form_id}'
"
);

while ($level = $rs->fetch()) {
$pokemon_form_name = $level['pokemon_form_name'];
}
debug_log($pokemon_form_name, 'Per db, level is:');
} else {
debug_log('Faulty dex_id or form_id, defaulting to normal.');
$pokemon_form_name = 'normal';
}

return $pokemon_form_name;
}
?>
<?php
/**
* Get pokemon form name.
* @param $pokedex_id
* @param $pokemon_form_id
* @return string
*/
function get_pokemon_form_name($pokedex_id, $pokemon_form_id)
{
debug_log($pokedex_id.'-'.$pokemon_form_id, 'Finding Pokemon form name for:');

$pokemon_form_name = 'normal';
// Make sure $dex_id is numeric
if(is_numeric($pokedex_id) && is_numeric($pokemon_form_id)) {
// Get raid level from database
$rs = my_query(
"
SELECT pokemon_form_name
FROM pokemon
WHERE pokedex_id = {$pokedex_id}
AND pokemon_form_id = '{$pokemon_form_id}'
LIMIT 1
"
);

$level = $rs->fetch();
$pokemon_form_name = $level['pokemon_form_name'];

debug_log($pokemon_form_name, 'Per db, level is:');
} else {
debug_log('Faulty dex_id or form_id, defaulting to normal.');
}

return $pokemon_form_name;
}
?>

0 comments on commit 42ec093

Please sign in to comment.