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