Completed
Push — work-fleets ( 3f92e6...b16c77 )
by SuperNova.WS
07:09
created

flt_mission_attack.php ➔ flt_mission_attack()   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 6
eloc 14
nc 3
nop 1
dl 0
loc 25
rs 8.439
c 2
b 0
f 0
1
<?php
2
3
/*
4
  copyright © 2009-2016 Gorlum for http://supernova.ws
5
*/
6
7
// Used by game_skirmish
8
use Mission\Mission;
9
10
/**
11
 * @param Mission $objMission
12
 * @param array   $mission_data
0 ignored issues
show
Bug introduced by
There is no parameter named $mission_data. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
13
 */
14
function flt_mission_attack($objMission) {
15
  $objFleet = $objMission->fleet;
16
17
  if($objFleet->shipsGetTotal() <= 0) {
18
    return;
19
  }
20
21
  $destination_user = $objMission->dst_user;
22
23
  if(
24
    // Нет данных о планете назначения или её владельце
25
    empty($destination_user)
26
    ||
27
    !is_array($destination_user)
28
    ||
29
    // "Уничтожение" не на луну
30
    ($objFleet->mission_type == MT_DESTROY && $objFleet->fleet_end_type != PT_MOON)
31
  ) {
32
    $objFleet->markReturnedAndSave();
33
34
    return;
35
  }
36
37
  UBE::flt_mission_attack($objMission);
38
}
39