src/STV/ElectionRunner.php
protected function electCandidate(Candidate $candidate)
    {
        $this->logger->notice("Electing a candidate: $candidate");

        $candidate->setState(Candidate::ELECTED);
        ++$this->electedCandidates;
        --$this->candidatesToElect;

        if ($this->electedCandidates < $this->election->getWinnersCount()) {
            $surplus = $candidate->getVotes() - $this->quota;
            if ($surplus > 0) {
                $this->transferSurplusVotes($surplus, $candidate);
            } else {
                $this->logger->notice("No surplus votes from $candidate to reallocate");
            }
        }

        return;
    }
protected function electCandidate(Candidate $candidate)
    {
        $this->logger->notice("Electing a candidate: $candidate");

        $candidate->setState(Candidate::ELECTED);
        ++$this->electedCandidates;
        --$this->candidatesToElect;

        if ($this->electedCandidates < $this->election->getWinnersCount()) {
            $surplus = $candidate->getVotes() - $this->quota;
            if ($surplus > 0) {
                $this->transferSurplusVotes($surplus, $candidate);
            } else {
                $this->logger->notice("No surplus votes from $candidate to reallocate");
            }
        }

        return;
    }
protected function electCandidate ( Candidate $ candidate ) { $ this -> logger -> notice ( "Electing a candidate: $candidate" ) ; $ candidate -> setState ( Candidate :: ELECTED ) ; ++ $ this -> electedCandidates ; -- $ this -> candidatesToElect ; if ( $ this -> electedCandidates < $ this -> election -> getWinnersCount ( ) ) { $ surplus = $ candidate -> getVotes ( ) - $ this -> quota ; if ( $ surplus > 0 ) { $ this -> transferSurplusVotes ( $ surplus , $ candidate ) ; } else { $ this -> logger -> notice ( "No surplus votes from $candidate to reallocate" ) ; } } return ; }
Elect a candidate after they've passed the threshold.

@param Candidate $candidate
Elect a candidate after they ve passed the threshold .