/** * @param Play $other * * @return bool */ public function isEqual(Play $other) { return $this->turnNumber === $other->turnNumber && $this->stone->isEqual($other->stone) && $this->side === $other->side; }
private function assertContainsStone(array $stones, Dto\Stone $stone) { $containsStone = array_reduce($stones, function ($carry, Dto\Stone $other) use($stone) { return $carry || $stone->getTopValue() === $other->getTopValue() && $stone->getBottomValue() === $other->getBottomValue(); }, false); $this->assertTrue($containsStone, 'expected to find stone in stone collection'); }