Completed
Push — trunk ( e8681e...314ee9 )
by SuperNova.WS
13:57
created

Planet::getGovernor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Created by Gorlum 08.01.2018 14:30
5
 */
6
7
namespace Planet;
8
9
10
use Core\EntityDb;
11
use Unit\Governor;
12
13
/**
14
 * Class Planet
15
 * @package Planet
16
 *
17
 * @property int|string $id - Record ID name would be normalized to 'id'
18
 * @property string    $name
19
 * @property int|float $id_owner
20
 * @property int       $galaxy
21
 * @property int       $system
22
 * @property int       $planet
23
 * @property int       $planet_type
24
// * @property int|float $metal
25
// * @property int|float $crystal
26
// * @property int|float $deuterium
27
// * @property int|float $energy_max
28
// * @property int|float $energy_used
29
// * @property int       $last_jump_time
30
// * @property int       $metal_perhour
31
// * @property int       $crystal_perhour
32
// * @property int       $deuterium_perhour
33
// * @property int       $metal_mine_porcent
34
// * @property int       $crystal_mine_porcent
35
// * @property int       $deuterium_sintetizer_porcent
36
// * @property int       $solar_plant_porcent
37
// * @property int       $fusion_plant_porcent
38
// * @property int       $solar_satelit_porcent
39
// * @property int       $last_update
40
// * @property int       $que_processed
41
// * @property string    $image
42
// * @property int|float $points
43
// * @property int|float $ranks
44
// * @property int       $id_level
45
// * @property int       $destruyed
46
// * @property int       $diameter
47
// * @property int       $field_max
48
// * @property int       $field_current
49
// * @property int       $temp_min
50
// * @property int       $temp_max
51
// * @property int|float $metal_max
52
// * @property int|float $crystal_max
53
// * @property int|float $deuterium_max
54
// * @property int|float $parent_planet
55
// * @property int|float $debris_metal
56
// * @property int|float $debris_crystal
57
 * @property int       $PLANET_GOVERNOR_ID
58
 * @property int       $PLANET_GOVERNOR_LEVEL
59
// * @property int       $planet_teleport_next
60
// * @property int       $ship_sattelite_sloth_porcent
61
// * @property int       $density
62
// * @property int       $density_index
63
// * @property int       $position_original
64
// * @property int       $field_max_original
65
// * @property int       $temp_min_original
66
// * @property int       $temp_max_original
67
 */
68
69
class Planet extends EntityDb {
70
71
  /**
72
   * @var string $_activeClass
73
   */
74
  protected $_activeClass = '\\Planet\\RecordPlanet';
75
76
  /**
77
   * @var RecordPlanet $_container
78
   */
79
  protected $_container;
80
81
  /**
82
   * @var Governor $governor
83
   */
84
  protected $governor;
85
86
  /**
87
   * Planet constructor.
88
   *
89
   * @param int $id
90
   */
91
  public function __construct($id = 0) {
92
    parent::__construct($id);
93
  }
94
95
  public function getGovernor() {
96
    if (empty($this->governor)) {
97
      $this->governor = new Governor();
98
      $this->governor->setPlanet($this);
99
    }
100
101
    return $this->governor;
102
  }
103
104
  public function governorHire($hireId) {
105
    $this->getGovernor()->hire($hireId);
106
  }
107
108
}
109