Skip to content

Commit

Permalink
Improvements thanks to Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Sep 20, 2021
1 parent 68530cf commit 6cf3412
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion classes/Ships/ShipsGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function updateDestroyedShip(int $ship_id, int $rating = 0): void
$stmt = $this->pdo_db->prepare($sql);
$stmt->bindParam(':ship_id', $ship_id, \PDO::PARAM_INT);
$stmt->bindParam(':rating', $rating, \PDO::PARAM_INT);
$result = $stmt->execute();
$stmt->execute();
\Tki\Db::logDbErrors($this->pdo_db, $sql, __LINE__, __FILE__);
}
}
12 changes: 6 additions & 6 deletions classes/Traderoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->execute();
$ownerinfo = $stmt->fetch(\PDO::FETCH_ASSOC);

if ($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0 || $playerinfo['team'] != $ownerinfo['team'])
if (($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0) || ($playerinfo['team'] != $ownerinfo['team']))
{
\Tki\TraderouteDie::die($pdo_db, $lang, $tkireg, $tkitimer, $template, $langvars['l_tdr_tradesrcportoutsider']);
}
Expand Down Expand Up @@ -343,7 +343,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->execute();
$ownerinfo = $stmt->fetch(\PDO::FETCH_ASSOC);

if ($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0 || $playerinfo['team'] != $ownerinfo['team'])
if (($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0) || ($playerinfo['team'] != $ownerinfo['team']))
{
\Tki\TraderouteDie::die($pdo_db, $lang, $tkireg, $tkitimer, $template, $langvars['l_tdr_tradedestportoutsider']);
}
Expand Down Expand Up @@ -702,7 +702,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->bindParam(':goods_buy', $goods_buy, \PDO::PARAM_INT);
$stmt->bindParam(':organics_buy', $organics_buy, \PDO::PARAM_INT);
$stmt->bindParam(':sector_id', $source['sector_id'], \PDO::PARAM_INT);
$result = $stmt->execute();
$stmt->execute();
\Tki\Db::logDbErrors($pdo_db, $sql, __LINE__, __FILE__);
}

Expand Down Expand Up @@ -740,7 +740,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->bindParam(':goods_buy', $goods_buy, \PDO::PARAM_INT);
$stmt->bindParam(':organics_buy', $organics_buy, \PDO::PARAM_INT);
$stmt->bindParam(':sector_id', $source['sector_id'], \PDO::PARAM_INT);
$result = $stmt->execute();
$stmt->execute();
\Tki\Db::logDbErrors($pdo_db, $sql, __LINE__, __FILE__);
}

Expand All @@ -767,7 +767,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->bindParam(':ship_organics', $playerinfo['ship_organics'], \PDO::PARAM_INT);
$stmt->bindParam(':ship_energy', $dist['ship_energy'], \PDO::PARAM_INT);
$stmt->bindParam(':ship_id', $playerinfo['ship_id'], \PDO::PARAM_INT);
$result = $stmt->execute();
$stmt->execute();
\Tki\Db::logDbErrors($pdo_db, $sql, __LINE__, __FILE__);
}
}
Expand Down Expand Up @@ -856,7 +856,7 @@ public static function engage(\PDO $pdo_db, string $lang, int $tr_repeat, Regist
$stmt->bindParam(':goods_buy', $goods_buy, \PDO::PARAM_INT);
$stmt->bindParam(':organics_buy', $organics_buy, \PDO::PARAM_INT);
$stmt->bindParam(':planet_id', $source['planet_id'], \PDO::PARAM_INT);
$result = $stmt->execute();
$stmt->execute();
\Tki\Db::logDbErrors($pdo_db, $sql, __LINE__, __FILE__);
}
// Destination is a planet, so load colonists and weapons
Expand Down
2 changes: 1 addition & 1 deletion classes/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function load(\PDO $pdo_db, string $language, array $categories):
{
$ini_file = './languages/' . $language . '.ini';
$ini_keys = parse_ini_file($ini_file, true, INI_SCANNER_TYPED);
if (is_array($ini_keys))
if ($ini_keys !== false)
{
foreach ($ini_keys as $config_line)
{
Expand Down
2 changes: 1 addition & 1 deletion port2.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
$players_gateway = new \Tki\Players\PlayersGateway($pdo_db);
$ownerinfo = $players_gateway->selectPlayerInfoById($zoneinfo['owner']);

if ($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0 || $playerinfo['team'] != $ownerinfo['team'])
if (($playerinfo['ship_id'] != $zoneinfo['owner'] && $playerinfo['team'] == 0) || ($playerinfo['team'] != $ownerinfo['team']))
{
$title = $langvars['l_no_trade'];
echo "<h1>" . $title . "</h1>\n";
Expand Down

0 comments on commit 6cf3412

Please sign in to comment.