| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Syntax\SteamApi\Containers\Player; |
||
| 20 | public function __construct($levelDetails) |
||
| 21 | { |
||
| 22 | $this->playerXp = $levelDetails->player_xp; |
||
| 23 | $this->playerLevel = $levelDetails->player_level; |
||
| 24 | $this->xpToLevelUp = $levelDetails->player_xp_needed_to_level_up; |
||
| 25 | $this->xpForCurrentLevel = $levelDetails->player_xp_needed_current_level; |
||
| 26 | |||
| 27 | $this->currentLevelFloor = $this->xpForCurrentLevel; |
||
| 28 | $this->currentLevelCeiling = $this->playerXp + $this->xpToLevelUp; |
||
| 29 | |||
| 30 | // arbitrary range formula. n = value in the middle ( n - min ) / ( max - min ) * 100 |
||
| 31 | $this->percentThroughLevel = ($this->playerXp - $this->currentLevelFloor) / ($this->currentLevelCeiling - $this->currentLevelFloor) * 100; |
||
| 32 | } |
||
| 33 | } |