election = $election = new Election; $this->election->setNumberOfSeats((int) ($numberOfCandidates / 3)); $candidates = []; for ($i=0; $i < $numberOfCandidates; $i++) { $candidates[] = $election->addCandidate(); } for ($i = 0; $i < $numberOfVotes; $i++) { $oneVote = $randomizer->shuffleArray($candidates); $election->addVote($oneVote); } } public function provideNumberOfCandidates(): \Generator { foreach ($this->numberOfCandidates as $n) { yield $n => ['numberOfCandidates' => $n]; } } public function provideNumberOfVotes(): \Generator { foreach ($this->numberOfVotes as $n) { yield $n => ['numberOfVotes' => $n]; } } #[Bench\OutputTimeUnit('seconds')] #[Bench\ParamProviders(['provideNumberOfCandidates', 'provideNumberOfVotes'])] #[Bench\Warmup(0)] #[Bench\Iterations(1)] #[Bench\Revs(1)] public function benchByCandidates(array $params): void { $this->buildElection($params['numberOfCandidates'], $params['numberOfVotes']); } }