mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-11 17:14:13 +00:00
Upgrade with rector
This commit is contained in:
@ -5,13 +5,11 @@ namespace DNW\Skills;
|
||||
/**
|
||||
* Represents a player who has a Rating.
|
||||
*/
|
||||
class Player implements ISupportPartialPlay, ISupportPartialUpdate
|
||||
class Player implements ISupportPartialPlay, ISupportPartialUpdate, \Stringable
|
||||
{
|
||||
const DEFAULT_PARTIAL_PLAY_PERCENTAGE = 1.0; // = 100% play time
|
||||
final const DEFAULT_PARTIAL_PLAY_PERCENTAGE = 1.0; // = 100% play time
|
||||
|
||||
const DEFAULT_PARTIAL_UPDATE_PERCENTAGE = 1.0; // = receive 100% update
|
||||
|
||||
private $_Id;
|
||||
final const DEFAULT_PARTIAL_UPDATE_PERCENTAGE = 1.0;
|
||||
|
||||
private $_PartialPlayPercentage;
|
||||
|
||||
@ -20,18 +18,17 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate
|
||||
/**
|
||||
* Constructs a player.
|
||||
*
|
||||
* @param mixed $id The identifier for the player, such as a name.
|
||||
* @param mixed $_Id The identifier for the player, such as a name.
|
||||
* @param number $partialPlayPercentage The weight percentage to give this player when calculating a new rank.
|
||||
* @param number $partialUpdatePercentage Indicated how much of a skill update a player should receive where 0 represents no update and 1.0 represents 100% of the update.
|
||||
*/
|
||||
public function __construct($id,
|
||||
public function __construct(private $_Id,
|
||||
$partialPlayPercentage = self::DEFAULT_PARTIAL_PLAY_PERCENTAGE,
|
||||
$partialUpdatePercentage = self::DEFAULT_PARTIAL_UPDATE_PERCENTAGE)
|
||||
{
|
||||
// If they don't want to give a player an id, that's ok...
|
||||
Guard::argumentInRangeInclusive($partialPlayPercentage, 0.0, 1.0, 'partialPlayPercentage');
|
||||
Guard::argumentInRangeInclusive($partialUpdatePercentage, 0, 1.0, 'partialUpdatePercentage');
|
||||
$this->_Id = $id;
|
||||
$this->_PartialPlayPercentage = $partialPlayPercentage;
|
||||
$this->_PartialUpdatePercentage = $partialUpdatePercentage;
|
||||
}
|
||||
@ -60,7 +57,7 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate
|
||||
return $this->_PartialUpdatePercentage;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->_Id;
|
||||
}
|
||||
|
Reference in New Issue
Block a user