Issues (1369)

classes/Universe.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Created by Gorlum 25.03.2023 21:11
5
 */
6
class Universe {
7
8
  /**
9
   * @param $from
10
   * @param $to
11
   *
12
   * @return float|int
13
   */
14
  public static function distance($from, $to) {
15
    if ($from['galaxy'] != $to['galaxy']) {
16
      $distance = abs($from['galaxy'] - $to['galaxy']) * self::getBaseGalaxyDistance();
17
    } elseif ($from['system'] != $to['system']) {
18
      $distance = abs($from['system'] - $to['system']) * 5 * 19 + 2700;
19
    } elseif ($from['planet'] != $to['planet']) {
20
      $distance = abs($from['planet'] - $to['planet']) * 5 + 1000;
21
    } else {
22
      $distance = 5;
23
    }
24
25
    return $distance;
26
  }
27
28
  public static function getBaseGalaxyDistance() {
29
    return SN::$config->uni_galaxy_distance ? SN::$config->uni_galaxy_distance : UNIVERSE_GALAXY_DISTANCE;
30
  }
31
32
  /**
33
   * Get fleet flying speed aka... hmph... fleet flying speed
34
   *
35
   * @param bool $plain
36
   *
37
   * @return float|int
38
   */
39
  public static function flt_server_flight_speed_multiplier($plain = false) {
40
    return getValueFromStorage(UNIT_SERVER_SPEED_FLEET, $plain);
0 ignored issues
show
UNIT_SERVER_SPEED_FLEET of type string is incompatible with the type integer expected by parameter $unitSnId of getValueFromStorage(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
    return getValueFromStorage(/** @scrutinizer ignore-type */ UNIT_SERVER_SPEED_FLEET, $plain);
Loading history...
41
  }
42
43
}
44