Completed
Push — trunk ( 91a948...0e7a2e )
by SuperNova.WS
05:44
created

FleetStatic   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A dbFleetsOnHoldOnPlanetsByIds() 0 10 1
1
<?php
2
/**
3
 * Created by Gorlum 21.03.2018 13:27
4
 */
5
6
namespace Fleet;
7
8
use SN;
9
10
class FleetStatic {
11
12
  /**
13
   * @param array $planetIds
14
   * @param int   $time
15
   *
16
   * @return \mysqli_result|false
17
   */
18
  public static function dbFleetsOnHoldOnPlanetsByIds($planetIds, $time = SN_TIME_NOW) {
19
    return SN::$db->doquery(
0 ignored issues
show
Bug Best Practice introduced by
The expression return SN::db->doquery('... . ' FOR UPDATE') also could return the type boolean which is incompatible with the documented return type false|mysqli_result.
Loading history...
20
      "SELECT `{{fleets}}`.*
21
      FROM `{{fleets}}`
22
        LEFT JOIN `{{users}}` ON id = fleet_owner
23
      WHERE
24
        fleet_end_planet_id IN (" . implode(',', $planetIds) . ")
25
        AND fleet_mess = 0
26
        AND fleet_start_time <= " . $time . "
27
        AND fleet_end_stay >= " . $time . "
28
      FOR UPDATE"
29
    );
30
31
  }
32
}