Update StatisticManager.php (#218)
* Update StatisticManager.php Fix warning PHP 7.3 * Update StatisticManager.php Rollback change inside foreach
This commit is contained in:
		
				
					committed by
					
						
						Lukas Kremsmayr
					
				
			
			
				
	
			
			
			
						parent
						
							0c28d683f5
						
					
				
				
					commit
					3a10908d25
				
			@@ -392,67 +392,67 @@ class StatisticManager implements UsageInformationAble {
 | 
				
			|||||||
			switch ($stat->name) {
 | 
								switch ($stat->name) {
 | 
				
			||||||
				case self::SPECIAL_STAT_KD_RATIO:
 | 
									case self::SPECIAL_STAT_KD_RATIO:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_ON_KILL]) || !isset($playerStats[StatisticCollector::STAT_ON_DEATH])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_ON_KILL]) || !isset($playerStats[StatisticCollector::STAT_ON_DEATH])) {
 | 
				
			||||||
						continue;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$kills  = intval($playerStats[StatisticCollector::STAT_ON_KILL][1]);
 | 
										$kills  = intval($playerStats[StatisticCollector::STAT_ON_KILL][1]);
 | 
				
			||||||
					$deaths = intval($playerStats[StatisticCollector::STAT_ON_DEATH][1]);
 | 
										$deaths = intval($playerStats[StatisticCollector::STAT_ON_DEATH][1]);
 | 
				
			||||||
					if (!$deaths) {
 | 
										if (!$deaths) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, $kills / $deaths);
 | 
										$playerStats[$stat->name] = array($stat, $kills / $deaths);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case self::SPECIAL_STAT_HITS_PH:
 | 
									case self::SPECIAL_STAT_HITS_PH:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_PLAYTIME]) || !isset($playerStats[StatisticCollector::STAT_ON_HIT])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_PLAYTIME]) || !isset($playerStats[StatisticCollector::STAT_ON_HIT])) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$hits = intval($playerStats[StatisticCollector::STAT_ON_HIT][1]);
 | 
										$hits = intval($playerStats[StatisticCollector::STAT_ON_HIT][1]);
 | 
				
			||||||
					$time = intval($playerStats[StatisticCollector::STAT_PLAYTIME][1]);
 | 
										$time = intval($playerStats[StatisticCollector::STAT_PLAYTIME][1]);
 | 
				
			||||||
					if (!$time) {
 | 
										if (!$time) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, $hits / ($time / 3600));
 | 
										$playerStats[$stat->name] = array($stat, $hits / ($time / 3600));
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case self::SPECIAL_STAT_ARROW_ACC:
 | 
									case self::SPECIAL_STAT_ARROW_ACC:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_ARROW_HIT]) || !isset($playerStats[StatisticCollector::STAT_ARROW_SHOT])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_ARROW_HIT]) || !isset($playerStats[StatisticCollector::STAT_ARROW_SHOT])) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$hits  = intval($playerStats[StatisticCollector::STAT_ARROW_HIT][1]);
 | 
										$hits  = intval($playerStats[StatisticCollector::STAT_ARROW_HIT][1]);
 | 
				
			||||||
					$shots = intval($playerStats[StatisticCollector::STAT_ARROW_SHOT][1]);
 | 
										$shots = intval($playerStats[StatisticCollector::STAT_ARROW_SHOT][1]);
 | 
				
			||||||
					if (!$shots) {
 | 
										if (!$shots) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
										$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case self::SPECIAL_STAT_LASER_ACC:
 | 
									case self::SPECIAL_STAT_LASER_ACC:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_LASER_HIT]) || !isset($playerStats[StatisticCollector::STAT_LASER_SHOT])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_LASER_HIT]) || !isset($playerStats[StatisticCollector::STAT_LASER_SHOT])) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$hits  = intval($playerStats[StatisticCollector::STAT_LASER_HIT][1]);
 | 
										$hits  = intval($playerStats[StatisticCollector::STAT_LASER_HIT][1]);
 | 
				
			||||||
					$shots = intval($playerStats[StatisticCollector::STAT_LASER_SHOT][1]);
 | 
										$shots = intval($playerStats[StatisticCollector::STAT_LASER_SHOT][1]);
 | 
				
			||||||
					if (!$shots) {
 | 
										if (!$shots) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
										$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case self::SPECIAL_STAT_ROCKET_ACC:
 | 
									case self::SPECIAL_STAT_ROCKET_ACC:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_ROCKET_HIT]) || !isset($playerStats[StatisticCollector::STAT_ROCKET_SHOT])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_ROCKET_HIT]) || !isset($playerStats[StatisticCollector::STAT_ROCKET_SHOT])) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$hits  = intval($playerStats[StatisticCollector::STAT_ROCKET_HIT][1]);
 | 
										$hits  = intval($playerStats[StatisticCollector::STAT_ROCKET_HIT][1]);
 | 
				
			||||||
					$shots = intval($playerStats[StatisticCollector::STAT_ROCKET_SHOT][1]);
 | 
										$shots = intval($playerStats[StatisticCollector::STAT_ROCKET_SHOT][1]);
 | 
				
			||||||
					if (!$shots) {
 | 
										if (!$shots) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
										$playerStats[$stat->name] = array($stat, $hits / $shots);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case self::SPECIAL_STAT_NUCLEUS_ACC:
 | 
									case self::SPECIAL_STAT_NUCLEUS_ACC:
 | 
				
			||||||
					if (!isset($playerStats[StatisticCollector::STAT_NUCLEUS_HIT]) || !isset($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT])) {
 | 
										if (!isset($playerStats[StatisticCollector::STAT_NUCLEUS_HIT]) || !isset($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT])) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$hits  = intval($playerStats[StatisticCollector::STAT_NUCLEUS_HIT][1]);
 | 
										$hits  = intval($playerStats[StatisticCollector::STAT_NUCLEUS_HIT][1]);
 | 
				
			||||||
					$shots = intval($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT][1]);
 | 
										$shots = intval($playerStats[StatisticCollector::STAT_NUCLEUS_SHOT][1]);
 | 
				
			||||||
					if (!$shots) {
 | 
										if (!$shots) {
 | 
				
			||||||
						continue;
 | 
					                        break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					$playerStats[$stat->name] = array($stat, (float) ($hits / $shots));
 | 
										$playerStats[$stat->name] = array($stat, (float) ($hits / $shots));
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user