mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-25 07:47:42 +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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
foreach ($games as $roundgame) {
|
foreach ($games as $roundgame) {
|
||||||
if ($roundgame->White == $game->White &&
|
if ($game->equals($roundgame)) {
|
||||||
$roundgame->Black == $game->Black &&
|
|
||||||
$roundgame->Result == $game->Result
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user