protected function checkAllBallotCandidatesValid(array $ranking): bool
    {
        $candidateIds = $this->election->getCandidateIds();

        foreach ($ranking as $candidate) {
            if (!in_array($candidate, $candidateIds)) {
                $this->logger->debug('Invalid ballot - invalid candidate');

                return false;
            }
        }

        return true;
    }