diff --git a/PHPSkills/HashMap.php b/PHPSkills/HashMap.php
index db43bdf..277943e 100644
--- a/PHPSkills/HashMap.php
+++ b/PHPSkills/HashMap.php
@@ -35,7 +35,7 @@ class HashMap
}
public function count()
- {
+ {
return \count($this->_hashToKey);
}
diff --git a/PHPSkills/RatingContainer.php b/PHPSkills/RatingContainer.php
index 6782910..95ddf31 100644
--- a/PHPSkills/RatingContainer.php
+++ b/PHPSkills/RatingContainer.php
@@ -39,7 +39,7 @@ class RatingContainer
public function count()
{
- return \count($this->_playerToRating->count());
+ return $this->_playerToRating->count();
}
}
?>
diff --git a/PHPSkills/SkillCalculator.php b/PHPSkills/SkillCalculator.php
index dbbb292..569dc90 100644
--- a/PHPSkills/SkillCalculator.php
+++ b/PHPSkills/SkillCalculator.php
@@ -14,7 +14,7 @@ abstract class SkillCalculator
private $_playersPerTeamAllowed;
private $_totalTeamsAllowed;
- protected function __construct($supportedOptions, TeamsRange &$totalTeamsAllowed, PlayersRange &$playerPerTeamAllowed)
+ protected function __construct($supportedOptions, TeamsRange $totalTeamsAllowed, PlayersRange $playerPerTeamAllowed)
{
$this->_supportedOptions = $supportedOptions;
$this->_totalTeamsAllowed = $totalTeamsAllowed;
diff --git a/PHPSkills/Team.php b/PHPSkills/Team.php
index d818625..8b5f80e 100644
--- a/PHPSkills/Team.php
+++ b/PHPSkills/Team.php
@@ -7,7 +7,7 @@ require_once(dirname(__FILE__) . '/RatingContainer.php');
class Team extends RatingContainer
{
- public function __construct(Player &$player = null, Rating &$rating = null)
+ public function __construct(Player &$player = null, Rating $rating = null)
{
parent::__construct();
@@ -17,7 +17,7 @@ class Team extends RatingContainer
}
}
- public function addPlayer(Player &$player, Rating &$rating)
+ public function addPlayer(Player &$player, Rating $rating)
{
$this->setRating($player, $rating);
return $this;
diff --git a/PHPSkills/TrueSkill/TwoPlayerTrueSkillCalculator.php b/PHPSkills/TrueSkill/TwoPlayerTrueSkillCalculator.php
index 0e49026..3292395 100644
--- a/PHPSkills/TrueSkill/TwoPlayerTrueSkillCalculator.php
+++ b/PHPSkills/TrueSkill/TwoPlayerTrueSkillCalculator.php
@@ -140,7 +140,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
}
///
- public function calculateMatchQuality(GameInfo $gameInfo, array $teams)
+ public function calculateMatchQuality(GameInfo &$gameInfo, array &$teams)
{
Guard::argumentNotNull($gameInfo, "gameInfo");
$this->validateTeamCountAndPlayersCountPerTeam($teams);
diff --git a/PHPSkills/TrueSkill/TwoTeamTrueSkillCalculator.php b/PHPSkills/TrueSkill/TwoTeamTrueSkillCalculator.php
index ac1f598..e7c34c1 100644
--- a/PHPSkills/TrueSkill/TwoTeamTrueSkillCalculator.php
+++ b/PHPSkills/TrueSkill/TwoTeamTrueSkillCalculator.php
@@ -47,7 +47,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
parent::__construct(SkillCalculatorSupportedOptions::NONE, TeamsRange::exactly(2), PlayersRange::atLeast(1));
}
- public function calculateNewRatings(GameInfo $gameInfo,
+ public function calculateNewRatings(GameInfo &$gameInfo,
array $teams,
array $teamRanks)
{
@@ -146,7 +146,8 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
$rankMultiplier = 1;
}
- foreach ($selfTeam->getAllPlayers() as &$selfTeamCurrentPlayer)
+ $selfTeamAllPlayers = &$selfTeam->getAllPlayers();
+ foreach ($selfTeamAllPlayers as &$selfTeamCurrentPlayer)
{
$localSelfTeamCurrentPlayer = &$selfTeamCurrentPlayer;
$previousPlayerRating = $selfTeam->getRating($localSelfTeamCurrentPlayer);
@@ -165,7 +166,8 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
}
///
- public function calculateMatchQuality(GameInfo $gameInfo, array $teams)
+ public function calculateMatchQuality(GameInfo &$gameInfo,
+ array &$teams)
{
Guard::argumentNotNull($gameInfo, "gameInfo");
$this->validateTeamCountAndPlayersCountPerTeam($teams);
diff --git a/UnitTests/runner_example.php b/UnitTests/runner_example.php
deleted file mode 100644
index 912bb3e..0000000
--- a/UnitTests/runner_example.php
+++ /dev/null
@@ -1,33 +0,0 @@
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-
-require_once(dirname(__FILE__) . '/../PHPSkills/RankSorter.php');
-
-
-use \PHPUnit_Framework_TestCase;
-
-class RankSorterTest extends PHPUnit_Framework_TestCase
-{
- public function testSort()
- {
- $team1 = array( "a" => 1, "b" => 2 );
- $team2 = array( "c" => 3, "d" => 4 );
- $team3 = array( "e" => 5, "f" => 6 );
-
- $teams = array($team1, $team2, $team3);
-
- $teamRanks = array(3, 1, 2);
-
- $sortedRanks = RankSorter::sort($teams, $teamRanks);
-
- $this->assertEquals($team2, $sortedRanks[0]);
- $this->assertEquals($team3, $sortedRanks[1]);
- $this->assertEquals($team1, $sortedRanks[2]);
-
- }
-}
-
-$testSuite = new \PHPUnit_Framework_TestSuite();
-$testSuite->addTest( new RankSorterTest("testSort"));
-
-\PHPUnit_TextUI_TestRunner::run($testSuite);
\ No newline at end of file
diff --git a/test.php b/test.php
deleted file mode 100644
index f963417..0000000
--- a/test.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
\ No newline at end of file