mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-12-22 04:11:22 +01:00
Fixing "Nesting level too deep" issue
This commit is contained in:
parent
3faa4be0bd
commit
6603b049a6
15
src/Game.php
15
src/Game.php
@ -82,4 +82,19 @@ class Game
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if 2 games are equal
|
||||
*
|
||||
* @param Game $game1
|
||||
* @param Game $game2
|
||||
* @return bool
|
||||
*/
|
||||
public function equals(Game $game): bool
|
||||
{
|
||||
return (
|
||||
$this->White->Player === $game->White->Player &&
|
||||
$this->Black->Player === $game->Black->Player &&
|
||||
$this->Result == $game->Result);
|
||||
}
|
||||
}
|
||||
|
@ -311,10 +311,7 @@ class Tournament
|
||||
return false;
|
||||
}
|
||||
foreach ($games as $roundgame) {
|
||||
if ($roundgame->White == $game->White &&
|
||||
$roundgame->Black == $game->Black &&
|
||||
$roundgame->Result == $game->Result
|
||||
) {
|
||||
if ($game->equals($roundgame)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user