public function testFindDoubles() { $array = [1, 2, 3, 2, 1]; $doubles = Math::findDoubles($array); $this->assertContains(2, $doubles); $this->assertContains(1, $doubles); }
protected function getUnaivalableHalfScoreIndexes() { $usedInRow = []; foreach ($this->extractionHistory->getRowHistory() as $number) { $usedInRow[] = Math::numberToHalfScore($number); } $usedInFolder = []; foreach ($this->extractionHistory->getFolderHistory() as $number) { $usedInFolder[] = Math::numberToHalfScore($number); } $usedTwiceInFolder = Math::findDoubles($usedInFolder); $consumed = []; foreach ($this->halfScores as $index => $halfScore) { if (count($halfScore) === 0) { $consumed[] = $index; } } return array_merge($consumed, $usedInRow, $usedTwiceInFolder); }