1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__serveur-vote-lalis/include/condorcet/Documentation/Election Class/public Election--addCandidate.md
2022-09-21 14:01:45 +02:00

1.6 KiB

public Election::addCandidate

Description

public Election->addCandidate ( [CondorcetPHP\Condorcet\Candidate|string|null $candidate = null] ): CondorcetPHP\Condorcet\Candidate

Add one candidate to an election.

candidate: CondorcetPHP\Condorcet\Candidate|string|null

Alphanumeric string or CondorcetPHP\Condorcet\Candidate object. The whitespace of your candidate name will be trimmed. If null, this function will create a new candidate with an automatic name.

Return value:

(CondorcetPHP\Condorcet\Candidate) The new candidate object (your or automatic one). Throws an exception on error (existing candidate...).

Throws:

  • CondorcetPHP\Condorcet\Throwable\CandidateExistsException
  • CondorcetPHP\Condorcet\Throwable\VotingHasStartedException


Examples and explanation