Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
21 | 1 | public function __construct($levelDetails) |
|
22 | { |
||
23 | 1 | $this->playerXp = $levelDetails->player_xp; |
|
24 | 1 | $this->playerLevel = $levelDetails->player_level; |
|
25 | 1 | $this->xpToLevelUp = $levelDetails->player_xp_needed_to_level_up; |
|
26 | 1 | $this->xpForCurrentLevel = $levelDetails->player_xp_needed_current_level; |
|
27 | |||
28 | 1 | $this->currentLevelFloor = $this->xpForCurrentLevel; |
|
29 | 1 | $this->currentLevelCeiling = $this->playerXp + $this->xpToLevelUp; |
|
30 | |||
31 | // arbitrary range formula. n = value in the middle ( n - min ) / ( max - min ) * 100 |
||
32 | 1 | $this->percentThroughLevel = ($this->playerXp - $this->currentLevelFloor) / ($this->currentLevelCeiling - $this->currentLevelFloor) * 100; |
|
33 | 1 | } |
|
34 | } |
||
35 |