Update StatisticManager.php (#218)

* Update StatisticManager.php

Fix warning PHP 7.3

* Update StatisticManager.php

Rollback change inside foreach
This commit is contained in:
jonthekiller 2019-04-27 19:31:06 +02:00 committed by Lukas Kremsmayr
parent 0c28d683f5
commit 3a10908d25

View File

@ -392,67 +392,67 @@ class StatisticManager implements UsageInformationAble {
switch ($stat->name) {
case self::SPECIAL_STAT_KD_RATIO:
if (!isset($playerStats[StatisticCollector::STAT_ON_KILL]) || !isset($playerStats[StatisticCollector::STAT_ON_DEATH])) {
continue;
break;
}
$kills = intval($playerStats[StatisticCollector::STAT_ON_KILL][1]);
$deaths = intval($playerStats[StatisticCollector::STAT_ON_DEATH][1]);
if (!$deaths) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, $kills / $deaths);
break;
case self::SPECIAL_STAT_HITS_PH:
if (!isset($playerStats[StatisticCollector::STAT_PLAYTIME]) || !isset($playerStats[StatisticCollector::STAT_ON_HIT])) {
continue;
break;
}
$hits = intval($playerStats[StatisticCollector::STAT_ON_HIT][1]);
$time = intval($playerStats[StatisticCollector::STAT_PLAYTIME][1]);
if (!$time) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, $hits / ($time / 3600));
break;
case self::SPECIAL_STAT_ARROW_ACC:
if (!isset($playerStats[StatisticCollector::STAT_ARROW_HIT]) || !isset($playerStats[StatisticCollector::STAT_ARROW_SHOT])) {
continue;
break;
}
$hits = intval($playerStats[StatisticCollector::STAT_ARROW_HIT][1]);
$shots = intval($playerStats[StatisticCollector::STAT_ARROW_SHOT][1]);
if (!$shots) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, $hits / $shots);
break;
case self::SPECIAL_STAT_LASER_ACC:
if (!isset($playerStats[StatisticCollector::STAT_LASER_HIT]) || !isset($playerStats[StatisticCollector::STAT_LASER_SHOT])) {
continue;
break;
}
$hits = intval($playerStats[StatisticCollector::STAT_LASER_HIT][1]);
$shots = intval($playerStats[StatisticCollector::STAT_LASER_SHOT][1]);
if (!$shots) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, $hits / $shots);
break;
case self::SPECIAL_STAT_ROCKET_ACC:
if (!isset($playerStats[StatisticCollector::STAT_ROCKET_HIT]) || !isset($playerStats[StatisticCollector::STAT_ROCKET_SHOT])) {
continue;
break;
}
$hits = intval($playerStats[StatisticCollector::STAT_ROCKET_HIT][1]);
$shots = intval($playerStats[StatisticCollector::STAT_ROCKET_SHOT][1]);
if (!$shots) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, $hits / $shots);
break;
case self::SPECIAL_STAT_NUCLEUS_ACC:
if (!isset($playerStats[StatisticCollector::STAT_NUCLEUS_HIT]) || !isset($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT])) {
continue;
break;
}
$hits = intval($playerStats[StatisticCollector::STAT_NUCLEUS_HIT][1]);
$shots = intval($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT][1]);
if (!$shots) {
continue;
break;
}
$playerStats[$stat->name] = array($stat, (float) ($hits / $shots));
break;