1
0

test adding condorcet vote

This commit is contained in:
2022-09-21 12:39:11 +02:00
parent 1e8adfa5d5
commit 0a30f39eb4
349 changed files with 36658 additions and 0 deletions

View File

@ -0,0 +1,22 @@
## public Algo\Pairwise::getExplicitPairwise
### Description
```php
public Algo\Pairwise->getExplicitPairwise ( ): array
```
Return the Pairwise.
### Return value:
*(```array```)* Pairwise as an explicit array .
---------------------------------------
### Related method(s)
* [Election::getPairwise](../Election%20Class/public%20Election--getPairwise.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)

View File

@ -0,0 +1,25 @@
## public Algo\Pairwise::getObjectVersion
### Description
```php
public Algo\Pairwise->getObjectVersion ( [bool $major = false] ): string
```
Get the Condorcet PHP version who built this Election object. Usefull pour serializing Election.
##### **major:** *```bool```*
true will return : '2.0' and false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [static Condorcet::getVersion](../Condorcet%20Class/public%20static%20Condorcet--getVersion.md)

View File

@ -0,0 +1,25 @@
## public static Algo\Tools\StvQuotas::make
### Description
```php
public static Algo\Tools\StvQuotas::make ( string $quota ): self
```
Build the Enum Quotas option for STV methods
##### **quota:** *```string```*
Quota name.
### Return value:
*(```self```)* The Quota option
---------------------------------------
### Examples and explanation
* **[Manual - STV method](https://github.com/julien-boudry/Condorcet/blob/master/VOTING_METHODS.md#single-transferable-vote)**

View File

@ -0,0 +1,25 @@
## public Candidate::__construct
### Description
```php
public Candidate->__construct ( string $name )
```
Build a candidate.
##### **name:** *```string```*
Candidate Name.
---------------------------------------
### Related method(s)
* [Candidate::setName](../Candidate%20Class/public%20Candidate--setName.md)
---------------------------------------
### Examples and explanation
* **[Manual - Create Candidates](https://github.com/julien-boudry/Condorcet/wiki/II-%23-A.-Create-an-Election-%23-2.-Create-Candidates)**

View File

@ -0,0 +1,25 @@
## public Candidate::countLinks
### Description
```php
public Candidate->countLinks ( ): int
```
Count number of linked election to this object.
### Return value:
*(```int```)* Number of linked elections.
---------------------------------------
### Related method(s)
* [Vote::countLinks](../Vote%20Class/public%20Vote--countLinks.md)
* [Vote::getLinks](../Vote%20Class/public%20Vote--getLinks.md)
* [Candidate::getLinks](../Candidate%20Class/public%20Candidate--getLinks.md)
* [Vote::haveLink](../Vote%20Class/public%20Vote--haveLink.md)
* [Candidate::haveLink](../Candidate%20Class/public%20Candidate--haveLink.md)

View File

@ -0,0 +1,21 @@
## public Candidate::getCreateTimestamp
### Description
```php
public Candidate->getCreateTimestamp ( ): float
```
Get the timestamp corresponding of the creation of this candidate.
### Return value:
*(```float```)* Timestamp
---------------------------------------
### Related method(s)
* [Candidate::getTimestamp](../Candidate%20Class/public%20Candidate--getTimestamp.md)

View File

@ -0,0 +1,21 @@
## public Candidate::getHistory
### Description
```php
public Candidate->getHistory ( ): array
```
Return an history of each namming change, with timestamp.
### Return value:
*(```array```)* An explicit multi-dimenssional array.
---------------------------------------
### Related method(s)
* [Candidate::getCreateTimestamp](../Candidate%20Class/public%20Candidate--getCreateTimestamp.md)

View File

@ -0,0 +1,25 @@
## public Candidate::getLinks
### Description
```php
public Candidate->getLinks ( ): WeakMap
```
Get elections object linked to this Vote or Candidate object.
### Return value:
*(```WeakMap```)* Populated by each elections Condorcet object.
---------------------------------------
### Related method(s)
* [Vote::countLinks](../Vote%20Class/public%20Vote--countLinks.md)
* [Candidate::countLinks](../Candidate%20Class/public%20Candidate--countLinks.md)
* [Vote::getLinks](../Vote%20Class/public%20Vote--getLinks.md)
* [Vote::haveLink](../Vote%20Class/public%20Vote--haveLink.md)
* [Candidate::haveLink](../Candidate%20Class/public%20Candidate--haveLink.md)

View File

@ -0,0 +1,22 @@
## public Candidate::getName
### Description
```php
public Candidate->getName ( ): string
```
Get the candidate name.
### Return value:
*(```string```)* Candidate name.
---------------------------------------
### Related method(s)
* [Candidate::getHistory](../Candidate%20Class/public%20Candidate--getHistory.md)
* [Candidate::setName](../Candidate%20Class/public%20Candidate--setName.md)

View File

@ -0,0 +1,25 @@
## public Candidate::getObjectVersion
### Description
```php
public Candidate->getObjectVersion ( [bool $major = false] ): string
```
Get the Condorcet PHP version who built this Election object. Usefull pour serializing Election.
##### **major:** *```bool```*
true will return : '2.0' and false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [static Condorcet::getVersion](../Condorcet%20Class/public%20static%20Condorcet--getVersion.md)

View File

@ -0,0 +1,19 @@
## public Candidate::getProvisionalState
### Description
```php
public Candidate->getProvisionalState ( ): bool
```
When you create yourself the vote object, without use the Election::addVote or other native election method. And if you use string input (or array of string).
Then, these string input will be converted to into temporary candidate objects, named "provisional". because you don't create the candidate yourself. They have a provisonal statut true.
When the vote will be added for the first time to an election, provisional candidate object with a name that matches an election candidate, will be converted into the election candidate. And first ranking will be save into Vote history (Vote::getHistory).
See VoteTest::testVoteHistory() test for a demonstration. In principle this is transparent from a usage point of view. If you want to avoid any non-strict comparisons, however, you should prefer to create your votes with the Election object, or with Candidate Objects in input. But, you must never getback a candidate marked as provisional in an another election in the same time, it's will not working.
### Return value:
*(```bool```)* True if candidate object is in a provisional state, false else.

View File

@ -0,0 +1,21 @@
## public Candidate::getTimestamp
### Description
```php
public Candidate->getTimestamp ( ): float
```
Get the timestamp corresponding of the last namming change.
### Return value:
*(```float```)* Timestamp
---------------------------------------
### Related method(s)
* [Candidate::getCreateTimestamp](../Candidate%20Class/public%20Candidate--getCreateTimestamp.md)

View File

@ -0,0 +1,29 @@
## public Candidate::haveLink
### Description
```php
public Candidate->haveLink ( CondorcetPHP\Condorcet\Election $election ): bool
```
Check if this election is linked with this Candidate/Vote object.
##### **election:** *```CondorcetPHP\Condorcet\Election```*
Condorcet election to check.
### Return value:
*(```bool```)* True or False.
---------------------------------------
### Related method(s)
* [Vote::countLinks](../Vote%20Class/public%20Vote--countLinks.md)
* [Candidate::countLinks](../Candidate%20Class/public%20Candidate--countLinks.md)
* [Vote::getLinks](../Vote%20Class/public%20Vote--getLinks.md)
* [Candidate::getLinks](../Candidate%20Class/public%20Candidate--getLinks.md)
* [Vote::haveLink](../Vote%20Class/public%20Vote--haveLink.md)

View File

@ -0,0 +1,25 @@
## public Candidate::setName
### Description
```php
public Candidate->setName ( string $name ): bool
```
Change the candidate name.
*If this will not cause conflicts if the candidate is already participating in elections and would namesake. This situation will throw an exception.*
##### **name:** *```string```*
Candidate Name.
### Return value:
*(```bool```)* In case of success, return TRUE
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\CandidateInvalidNameException```

View File

@ -0,0 +1,26 @@
## public static Condorcet::addMethod
### Description
```php
public static Condorcet::addMethod ( string $methodClass ): bool
```
If you create your own Condorcet Algo. You will need it !
##### **methodClass:** *```string```*
The class name implementing your method. The class name includes the namespace it was declared in (e.g. Foo\Bar).
### Return value:
*(```bool```)* True on Success. False on failure.
---------------------------------------
### Related method(s)
* [static Condorcet::isAuthMethod](../Condorcet%20Class/public%20static%20Condorcet--isAuthMethod.md)
* [static Condorcet::getMethodClass](../Condorcet%20Class/public%20static%20Condorcet--getMethodClass.md)

View File

@ -0,0 +1,26 @@
## public static Condorcet::getAuthMethods
### Description
```php
public static Condorcet::getAuthMethods ( [bool $basic = false] ): array
```
Get a list of supported algorithm.
##### **basic:** *```bool```*
Include or not the natural Condorcet base algorithm.
### Return value:
*(```array```)* Populated by method string name. You can use it on getResult ... and others methods.
---------------------------------------
### Related method(s)
* [static Condorcet::isAuthMethod](../Condorcet%20Class/public%20static%20Condorcet--isAuthMethod.md)
* [static Condorcet::getMethodClass](../Condorcet%20Class/public%20static%20Condorcet--getMethodClass.md)

View File

@ -0,0 +1,22 @@
## public static Condorcet::getDefaultMethod
### Description
```php
public static Condorcet::getDefaultMethod ( ): ?string
```
Return the Condorcet static default method.
### Return value:
*(```?string```)* Method name.
---------------------------------------
### Related method(s)
* [static Condorcet::getAuthMethods](../Condorcet%20Class/public%20static%20Condorcet--getAuthMethods.md)
* [static Condorcet::setDefaultMethod](../Condorcet%20Class/public%20static%20Condorcet--setDefaultMethod.md)

View File

@ -0,0 +1,30 @@
## public static Condorcet::getMethodClass
### Description
```php
public static Condorcet::getMethodClass ( string $method ): ?string
```
Return the full class path for a method.
##### **method:** *```string```*
A valid method name.
### Return value:
*(```?string```)* Return null is method not exist.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\AlgorithmException```
---------------------------------------
### Related method(s)
* [static Condorcet::getAuthMethods](../Condorcet%20Class/public%20static%20Condorcet--getAuthMethods.md)

View File

@ -0,0 +1,26 @@
## public static Condorcet::getVersion
### Description
```php
public static Condorcet::getVersion ( [bool $major = false] ): string
```
Get the library version.
##### **major:** *```bool```*
* true will return : '2.0'
* false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [Election::getObjectVersion](../Election%20Class/public%20Election--getObjectVersion.md)

View File

@ -0,0 +1,26 @@
## public static Condorcet::isAuthMethod
### Description
```php
public static Condorcet::isAuthMethod ( string $method ): bool
```
Test if a method is in the result set of Condorcet::getAuthMethods.
##### **method:** *```string```*
A valid method name or class.
### Return value:
*(```bool```)* True / False
---------------------------------------
### Related method(s)
* [static Condorcet::getMethodClass](../Condorcet%20Class/public%20static%20Condorcet--getMethodClass.md)
* [static Condorcet::getAuthMethods](../Condorcet%20Class/public%20static%20Condorcet--getAuthMethods.md)

View File

@ -0,0 +1,25 @@
## public static Condorcet::setDefaultMethod
### Description
```php
public static Condorcet::setDefaultMethod ( string $method ): bool
```
Put a new static method by default for the news Condorcet objects.
##### **method:** *```string```*
A valid method name or class.
### Return value:
*(```bool```)* In case of success, return TRUE
---------------------------------------
### Related method(s)
* [static Condorcet::getDefaultMethod](../Condorcet%20Class/public%20static%20Condorcet--getDefaultMethod.md)

View File

@ -0,0 +1,10 @@
## public Election::__construct
### Description
```php
public Election->__construct ( )
```
Build a new Election.

View File

@ -0,0 +1,41 @@
## public Election::addCandidate
### Description
```php
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```
---------------------------------------
### Related method(s)
* [Election::parseCandidates](../Election%20Class/public%20Election--parseCandidates.md)
* [Election::addCandidatesFromJson](../Election%20Class/public%20Election--addCandidatesFromJson.md)
* [Election::removeCandidate](../Election%20Class/public%20Election--removeCandidate.md)
* [Election::getCandidatesList](../Election%20Class/public%20Election--getCandidatesList.md)
* [Election::canAddCandidate](../Election%20Class/public%20Election--canAddCandidate.md)
---------------------------------------
### Examples and explanation
* **[Manual - Manage Candidate](https://github.com/julien-boudry/Condorcet/wiki/II-%23-A.-Create-an-Election-%23-2.-Create-Candidates)**

View File

@ -0,0 +1,38 @@
## public Election::addCandidatesFromJson
### Description
```php
public Election->addCandidatesFromJson ( string $input ): array
```
Import candidate from a JSON source.
##### **input:** *```string```*
JSON string input.
### Return value:
*(```array```)* List of newly registered candidate object.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\CandidateExistsException```
---------------------------------------
### Related method(s)
* [Election::addCandidate](../Election%20Class/public%20Election--addCandidate.md)
* [Election::parseCandidates](../Election%20Class/public%20Election--parseCandidates.md)
* [Election::addVotesFromJson](../Election%20Class/public%20Election--addVotesFromJson.md)
---------------------------------------
### Examples and explanation
* **[Manual - Manage Candidates](https://github.com/julien-boudry/Condorcet/wiki/II-%23-A.-Create-an-Election-%23-2.-Create-Candidates)**

View File

@ -0,0 +1,38 @@
## public Election::addConstraint
### Description
```php
public Election->addConstraint ( string $constraintClass ): bool
```
Add a constraint rules as a valid class path.
##### **constraintClass:** *```string```*
A valid class path. Class must extend VoteConstraint class.
### Return value:
*(```bool```)* True on success.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\VoteConstraintException```
---------------------------------------
### Related method(s)
* [Election::getConstraints](../Election%20Class/public%20Election--getConstraints.md)
* [Election::clearConstraints](../Election%20Class/public%20Election--clearConstraints.md)
* [Election::testIfVoteIsValidUnderElectionConstraints](../Election%20Class/public%20Election--testIfVoteIsValidUnderElectionConstraints.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote Constraints](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-5.-Vote-Constraints)**

View File

@ -0,0 +1,43 @@
## public Election::addVote
### Description
```php
public Election->addVote ( CondorcetPHP\Condorcet\Vote|array|string $vote [, array|string|null $tags = null] ): CondorcetPHP\Condorcet\Vote
```
Add a vote to an election.
##### **vote:** *```CondorcetPHP\Condorcet\Vote|array|string```*
String or array representation. Or CondorcetPHP\Condorcet\Vote object. If you not provide yourself Vote object, a new one will be generate for you.
##### **tags:** *```array|string|null```*
String separated by commas or an array. Will add tags to the vote object for you. But you can too add it yourself to Vote object.
### Return value:
*(```CondorcetPHP\Condorcet\Vote```)* The vote object.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\VoteMaxNumberReachedException```
---------------------------------------
### Related method(s)
* [Election::parseVotes](../Election%20Class/public%20Election--parseVotes.md)
* [Election::addVotesFromJson](../Election%20Class/public%20Election--addVotesFromJson.md)
* [Election::removeVote](../Election%20Class/public%20Election--removeVote.md)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote Management](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote)**

View File

@ -0,0 +1,33 @@
## public Election::addVotesFromJson
### Description
```php
public Election->addVotesFromJson ( string $input ): int
```
Import votes from a Json source.
##### **input:** *```string```*
Json string input.
### Return value:
*(```int```)* Count of new registered vote.
---------------------------------------
### Related method(s)
* [Election::addVote](../Election%20Class/public%20Election--addVote.md)
* [Election::parseVotes](../Election%20Class/public%20Election--parseVotes.md)
* [Election::addCandidatesFromJson](../Election%20Class/public%20Election--addCandidatesFromJson.md)
---------------------------------------
### Examples and explanation
* **[Manual - Add Vote](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote)**

View File

@ -0,0 +1,27 @@
## public Election::allowsVoteWeight
### Description
```php
public Election->allowsVoteWeight ( [bool $rule = true] ): bool
```
Set the setting and reset all result data.
Then the weight of votes (if specified) will be taken into account when calculating the results. Otherwise all votes will be considered equal.
By default, the voting weight is not activated and all votes are considered equal.
##### **rule:** *```bool```*
New rule.
### Return value:
*(```bool```)* Return True
---------------------------------------
### Related method(s)
* [Election::isVoteWeightAllowed](../Election%20Class/public%20Election--isVoteWeightAllowed.md)

View File

@ -0,0 +1,25 @@
## public Election::canAddCandidate
### Description
```php
public Election->canAddCandidate ( CondorcetPHP\Condorcet\Candidate|string $candidate ): bool
```
Check if a candidate is already registered. Uses strict Vote object comparison, but also string naming comparison in the election.
##### **candidate:** *```CondorcetPHP\Condorcet\Candidate|string```*
String or Condorcet/Vote object.
### Return value:
*(```bool```)* True if your candidate is available, false otherwise.
---------------------------------------
### Related method(s)
* [Election::addCandidate](../Election%20Class/public%20Election--addCandidate.md)

View File

@ -0,0 +1,29 @@
## public Election::clearConstraints
### Description
```php
public Election->clearConstraints ( ): bool
```
Clear all constraints rules and clear previous results.
### Return value:
*(```bool```)* Return True.
---------------------------------------
### Related method(s)
* [Election::getConstraints](../Election%20Class/public%20Election--getConstraints.md)
* [Election::addConstraints](../Election%20Class/public%20Election--addConstraints.md)
* [Election::testIfVoteIsValidUnderElectionConstraints](../Election%20Class/public%20Election--testIfVoteIsValidUnderElectionConstraints.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote Constraints](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-5.-Vote-Constraints)**

View File

@ -0,0 +1,21 @@
## public Election::computeResult
### Description
```php
public Election->computeResult ( [?string $method = null] ): void
```
Really similar to Election::getResult() but not return anything. Just calculates silently and fill the cache.
##### **method:** *```?string```*
Not requiered for use object default method. Set the string name of the algorithm for use an specific one.
---------------------------------------
### Related method(s)
* [Election::getWinner](../Election%20Class/public%20Election--getWinner.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
* [Condorcet::getDefaultMethod](../Condorcet%20Class/public%20Condorcet--getDefaultMethod.md)

View File

@ -0,0 +1,21 @@
## public Election::countCandidates
### Description
```php
public Election->countCandidates ( ): int
```
Count the number of registered candidates
### Return value:
*(```int```)* Number of registered candidates for this election.
---------------------------------------
### Related method(s)
* [Election::getCandidatesList](../Election%20Class/public%20Election--getCandidatesList.md)

View File

@ -0,0 +1,23 @@
## public Election::countInvalidVoteWithConstraints
### Description
```php
public Election->countInvalidVoteWithConstraints ( ): int
```
Count the number of actual invalid (if constraints functionality is enabled) but registered vote for this election.
### Return value:
*(```int```)* Number of valid and registered vote into this election.
---------------------------------------
### Related method(s)
* [Election::countValidVoteWithConstraints](../Election%20Class/public%20Election--countValidVoteWithConstraints.md)
* [Election::countVotes](../Election%20Class/public%20Election--countVotes.md)
* [Election::sumValidVotesWeightWithConstraints](../Election%20Class/public%20Election--sumValidVotesWeightWithConstraints.md)

View File

@ -0,0 +1,23 @@
## public Election::countValidVoteWithConstraints
### Description
```php
public Election->countValidVoteWithConstraints ( ): int
```
Count the number of actual registered and valid vote for this election. This method don't ignore votes constraints, only valid vote will be counted.
### Return value:
*(```int```)* Number of valid and registered vote into this election.
---------------------------------------
### Related method(s)
* [Election::countInvalidVoteWithConstraints](../Election%20Class/public%20Election--countInvalidVoteWithConstraints.md)
* [Election::countVotes](../Election%20Class/public%20Election--countVotes.md)
* [Election::sumValidVotesWeightWithConstraints](../Election%20Class/public%20Election--sumValidVotesWeightWithConstraints.md)

View File

@ -0,0 +1,30 @@
## public Election::countVotes
### Description
```php
public Election->countVotes ( [array|string|null $tags = null , bool $with = true] ): int
```
Count the number of actual registered and valid vote for this election. This method ignore votes constraints, only valid vote will be counted.
##### **tags:** *```array|string|null```*
Tag into string separated by commas, or an Array.
##### **with:** *```bool```*
Count Votes with this tag ou without this tag-.
### Return value:
*(```int```)* Number of valid and registered vote into this election.
---------------------------------------
### Related method(s)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)
* [Election::countValidVoteWithConstraints](../Election%20Class/public%20Election--countValidVoteWithConstraints.md)

View File

@ -0,0 +1,19 @@
## public Election::getCandidateObjectFromName
### Description
```php
public Election->getCandidateObjectFromName ( string $candidateName ): ?CondorcetPHP\Condorcet\Candidate
```
Find candidate object by string and return the candidate object.
##### **candidateName:** *```string```*
Candidate name.
### Return value:
*(```?CondorcetPHP\Condorcet\Candidate```)* Candidate object

View File

@ -0,0 +1,21 @@
## public Election::getCandidatesList
### Description
```php
public Election->getCandidatesList ( ): array
```
Return a list of registered candidates for this election.
### Return value:
*(```array```)* List of candidates in an array.
---------------------------------------
### Related method(s)
* [Election::countCandidates](../Election%20Class/public%20Election--countCandidates.md)

View File

@ -0,0 +1,21 @@
## public Election::getCandidatesListAsString
### Description
```php
public Election->getCandidatesListAsString ( ): array
```
Return a list of registered candidates for this election.
### Return value:
*(```array```)* List of candidates in an array populated with strings instead of CandidateObjects.
---------------------------------------
### Related method(s)
* [Election::countCandidates](../Election%20Class/public%20Election--countCandidates.md)

View File

@ -0,0 +1,27 @@
## public Election::getChecksum
### Description
```php
public Election->getChecksum ( ): string
```
SHA-2 256 checksum of following internal data:
* Candidates
* Votes list & tags
* Computed data (pairwise, algorithm cache, stats)
* Class version (major version like 0.14)
Can be powerfull to check integrity and security of an election. Or working with serialized object.
### Return value:
*(```string```)* SHA-2 256 bits Hexadecimal
---------------------------------------
### Examples and explanation
* **[Manual - Cryptographic Checksum](https://github.com/julien-boudry/Condorcet/wiki/III-%23-A.-Avanced-features---Configuration-%23-2.-Cryptographic-Checksum)**

View File

@ -0,0 +1,29 @@
## public Election::getCondorcetLoser
### Description
```php
public Election->getCondorcetLoser ( ): ?CondorcetPHP\Condorcet\Candidate
```
Get the natural Condorcet loser if there is one.
### Return value:
*(```?CondorcetPHP\Condorcet\Candidate```)* Candidate object given. Null if there are no available loser.
---------------------------------------
### Related method(s)
* [Election::getCondorcetWinner](../Election%20Class/public%20Election--getCondorcetWinner.md)
* [Election::getLoser](../Election%20Class/public%20Election--getLoser.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Manual - Natural Condorcet](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-1.-Natural-Condorcet)**

View File

@ -0,0 +1,29 @@
## public Election::getCondorcetWinner
### Description
```php
public Election->getCondorcetWinner ( ): ?CondorcetPHP\Condorcet\Candidate
```
Get the natural Condorcet winner if there is one.
### Return value:
*(```?CondorcetPHP\Condorcet\Candidate```)* Candidate object given. Null if there are no available winner.
---------------------------------------
### Related method(s)
* [Election::getCondorcetLoser](../Election%20Class/public%20Election--getCondorcetLoser.md)
* [Election::getWiner](../Election%20Class/public%20Election--getWiner.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Manual - Natural Condorcet](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-1.-Natural-Condorcet)**

View File

@ -0,0 +1,29 @@
## public Election::getConstraints
### Description
```php
public Election->getConstraints ( ): array
```
Get active constraints list.
### Return value:
*(```array```)* Array with class name of each active constraint. Empty array if there is not.
---------------------------------------
### Related method(s)
* [Election::clearConstraints](../Election%20Class/public%20Election--clearConstraints.md)
* [Election::addConstraints](../Election%20Class/public%20Election--addConstraints.md)
* [Election::testIfVoteIsValidUnderElectionConstraints](../Election%20Class/public%20Election--testIfVoteIsValidUnderElectionConstraints.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote Constraints](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-5.-Vote-Constraints)**

View File

@ -0,0 +1,22 @@
## public Election::getExplicitPairwise
### Description
```php
public Election->getExplicitPairwise ( ): array
```
Return the Pairwise.
### Return value:
*(```array```)* Pairwise as an explicit array .
---------------------------------------
### Related method(s)
* [Election::getPairwise](../Election%20Class/public%20Election--getPairwise.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)

View File

@ -0,0 +1,27 @@
## public Election::getGlobalTimer
### Description
```php
public Election->getGlobalTimer ( ): float
```
Returns the cumulated computation runtime of this object. Include only computation related methods.
### Return value:
*(```float```)* (Float) Timer
---------------------------------------
### Related method(s)
* [Election::getLastTimer](../Election%20Class/public%20Election--getLastTimer.md)
---------------------------------------
### Examples and explanation
* **[Manual - Timber benchmarking](https://github.com/julien-boudry/Condorcet/wiki/III-%23-A.-Avanced-features---Configuration-%23-1.-Timer-Benchmarking)**

View File

@ -0,0 +1,23 @@
## public Election::getImplicitRankingRule
### Description
```php
public Election->getImplicitRankingRule ( ): bool
```
Returns the corresponding setting as currently set (True by default).
If it is True then all votes expressing a partial ranking are understood as implicitly placing all the non-mentioned candidates exequos on a last rank.
If it is false, then the candidates not ranked, are not taken into account at all.
### Return value:
*(```bool```)* True / False
---------------------------------------
### Related method(s)
* [Election::setImplicitRanking](../Election%20Class/public%20Election--setImplicitRanking.md)

View File

@ -0,0 +1,27 @@
## public Election::getLastTimer
### Description
```php
public Election->getLastTimer ( ): float
```
Return the last computation runtime (typically after a getResult() call.). Include only computation related methods.
### Return value:
*(```float```)* (Float) Timer
---------------------------------------
### Related method(s)
* [Election::getGlobalTimer](../Election%20Class/public%20Election--getGlobalTimer.md)
---------------------------------------
### Examples and explanation
* **[Manual - Timber benchmarking](https://github.com/julien-boudry/Condorcet/wiki/III-%23-A.-Avanced-features---Configuration-%23-1.-Timer-Benchmarking)**

View File

@ -0,0 +1,40 @@
## public Election::getLoser
### Description
```php
public Election->getLoser ( [?string $method = null] ): CondorcetPHP\Condorcet\Candidate|array|null
```
Get the natural Condorcet loser if there is one. Alternatively you can get the loser(s) from an advanced Condorcet algorithm.
##### **method:** *```?string```*
*Only if not nulle:*
The loser will be provided by an advanced algorithm of an available advanced Condorcet method. For most of them, it will be the same as the Condorcet Marquis there. But if it does not exist, it may be different; and in some cases they may be multiple.
If null, Natural Condorcet algorithm will be use.
### Return value:
*(```CondorcetPHP\Condorcet\Candidate|array|null```)* Candidate object given. Null if there are no available winner or loser.
If you use an advanced method instead of Natural, you can get an array with multiples losers.
Throw an exception on error.
---------------------------------------
### Related method(s)
* [Election::getWinner](../Election%20Class/public%20Election--getWinner.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Manual - Natural Condorcet](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-1.-Natural-Condorcet)**

View File

@ -0,0 +1,22 @@
## public Election::getNumberOfSeats
### Description
```php
public Election->getNumberOfSeats ( ): int
```
Get number of Seats for STV methods.
### Return value:
*(```int```)* Number of seats.
---------------------------------------
### Related method(s)
* [Election::setNumberOfSeats](../Election%20Class/public%20Election--setNumberOfSeats.md)
* [Result::getNumberOfSeats](../Result%20Class/public%20Result--getNumberOfSeats.md)

View File

@ -0,0 +1,25 @@
## public Election::getObjectVersion
### Description
```php
public Election->getObjectVersion ( [bool $major = false] ): string
```
Get the Condorcet PHP version who built this Election object. Usefull pour serializing Election.
##### **major:** *```bool```*
true will return : '2.0' and false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [static Condorcet::getVersion](../Condorcet%20Class/public%20static%20Condorcet--getVersion.md)

View File

@ -0,0 +1,28 @@
## public Election::getPairwise
### Description
```php
public Election->getPairwise ( ): CondorcetPHP\Condorcet\Algo\Pairwise
```
Return the Pairwise.
### Return value:
*(```CondorcetPHP\Condorcet\Algo\Pairwise```)* Pairwise object.
---------------------------------------
### Related method(s)
* [Election::getExplicitPairwise](../Election%20Class/public%20Election--getExplicitPairwise.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Manual - Advanced Results](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-4.-Advanced-Results-Management)**

View File

@ -0,0 +1,42 @@
## public Election::getResult
### Description
```php
public Election->getResult ( [?string $method = null , array $methodOptions = []] ): CondorcetPHP\Condorcet\Result
```
Get a full ranking from an advanced Condorcet method.
*Have a look on the [supported method](https://github.com/julien-boudry/Condorcet/wiki/I-%23-Installation-%26-Basic-Configuration-%23-2.-Condorcet-Methods), or create [your own algorithm](https://github.com/julien-boudry/Condorcet/wiki/III-%23-C.-Extending-Condorcet-%23-1.-Add-your-own-ranking-algorithm).*
##### **method:** *```?string```*
Not required for use election default method. Set the string name of the algorithm for use of a specific one.
##### **methodOptions:** *```array```*
Array of option for some methods. Look at each method documentation.
### Return value:
*(```CondorcetPHP\Condorcet\Result```)* An Condorcet/Result Object (implementing ArrayAccess and Iterator, can be use like an array ordered by rank)
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\AlgorithmException```
---------------------------------------
### Related method(s)
* [Election::getWinner](../Election%20Class/public%20Election--getWinner.md)
* [Condorcet::getDefaultMethod](../Condorcet%20Class/public%20Condorcet--getDefaultMethod.md)
---------------------------------------
### Examples and explanation
* **[Manual - Ranking from Condorcet Method](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-2.-Get-Ranking-from-Condorcet-advanced-Methods)**

View File

@ -0,0 +1,23 @@
## public Election::getState
### Description
```php
public Election->getState ( ): CondorcetPHP\Condorcet\ElectionProcess\ElectionState
```
Get the election process level.
### Return value:
*(```CondorcetPHP\Condorcet\ElectionProcess\ElectionState```)* ElectionState::CANDIDATES_REGISTRATION: Candidate registered state. No votes, no result, no cache.
ElectionState::VOTES_REGISTRATION: Voting registration phase. Pairwise cache can exist thanks to dynamic computation if voting phase continue after the first get result. But method result never exist.
3: Result phase: Some method result may exist, pairwise exist. An election will return to Phase 2 if votes are added or modified dynamically.
---------------------------------------
### Related method(s)
* [Election::setStateToVote](../Election%20Class/public%20Election--setStateToVote.md)

View File

@ -0,0 +1,15 @@
## public Election::getStatsVerbosity
### Description
```php
public Election->getStatsVerbosity ( ): CondorcetPHP\Condorcet\Algo\StatsVerbosity
```
The current level of stats verbosity for this election object. Look at Election->setStatsVerbosity method for more informations.
### Return value:
*(```CondorcetPHP\Condorcet\Algo\StatsVerbosity```)* The current verbosity level for this election object.

View File

@ -0,0 +1,22 @@
## public Election::getTimerManager
### Description
```php
public Election->getTimerManager ( ): CondorcetPHP\Condorcet\Timer\Manager
```
Get the Timer manager object.
### Return value:
*(```CondorcetPHP\Condorcet\Timer\Manager```)* An CondorcetPHP\Condorcet\Timer\Manager object using by this election.
---------------------------------------
### Related method(s)
* [Election::getGlobalTimer](../Election%20Class/public%20Election--getGlobalTimer.md)
* [Election::getLastTimer](../Election%20Class/public%20Election--getLastTimer.md)

View File

@ -0,0 +1,30 @@
## public Election::getVotesList
### Description
```php
public Election->getVotesList ( [array|string|null $tags = null , bool $with = true] ): array
```
Get registered vote list.
##### **tags:** *```array|string|null```*
Tags list as a string separated by commas or array.
##### **with:** *```bool```*
Get votes with these tags or without.
### Return value:
*(```array```)* Populated by each Vote object.
---------------------------------------
### Related method(s)
* [Election::countVotes](../Election%20Class/public%20Election--countVotes.md)
* [Election::getVotesListAsString](../Election%20Class/public%20Election--getVotesListAsString.md)

View File

@ -0,0 +1,27 @@
## public Election::getVotesListAsString
### Description
```php
public Election->getVotesListAsString ( [bool $withContext = true] ): string
```
Get registered vote list.
##### **withContext:** *```bool```*
Depending of the implicit ranking rule of the election, will complete or not the ranking. If $withContext is false, ranking are never adapted to the context.
### Return value:
*(```string```)* Return a string like :<br>
A > B > C * 3<br>
A = B > C * 6
---------------------------------------
### Related method(s)
* [Election::parseVotes](../Election%20Class/public%20Election--parseVotes.md)

View File

@ -0,0 +1,30 @@
## public Election::getVotesListGenerator
### Description
```php
public Election->getVotesListGenerator ( [array|string|null $tags = null , bool $with = true] ): Generator
```
Same as Election::getVotesList. But Return a PHP generator object.
Usefull if your work on very large election with an external DataHandler, because it's will not using large memory amount.
##### **tags:** *```array|string|null```*
Tags list as a string separated by commas or array.
##### **with:** *```bool```*
Get votes with these tags or without.
### Return value:
*(```Generator```)* Populated by each Vote object.
---------------------------------------
### Related method(s)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)

View File

@ -0,0 +1,31 @@
## public Election::getVotesValidUnderConstraintGenerator
### Description
```php
public Election->getVotesValidUnderConstraintGenerator ( [array|string|null $tags = null , bool $with = true] ): Generator
```
Same as Election::getVotesList. But Return a PHP generator object.
Usefull if your work on very large election with an external DataHandler, because it's will not using large memory amount.
##### **tags:** *```array|string|null```*
Tags list as a string separated by commas or array.
##### **with:** *```bool```*
Get votes with these tags or without.
### Return value:
*(```Generator```)* Populated by each Vote object.
---------------------------------------
### Related method(s)
* [Election::getVotesListGenerator](../Election%20Class/public%20Election--getVotesListGenerator.md)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)

View File

@ -0,0 +1,41 @@
## public Election::getWinner
### Description
```php
public Election->getWinner ( [?string $method = null] ): CondorcetPHP\Condorcet\Candidate|array|null
```
Get the natural Condorcet winner if there is one. Alternatively you can get the winner(s) from an advanced Condorcet algorithm.
##### **method:** *```?string```*
*Only if not null: *
The winner will be provided by an advanced algorithm of an available advanced Condorcet method. For most of them, it will be the same as the Condorcet Marquis there. But if it does not exist, it may be different; and in some cases they may be multiple.
If null, Natural Condorcet algorithm will be use.
### Return value:
*(```CondorcetPHP\Condorcet\Candidate|array|null```)* Candidate object given. Null if there are no available winner or loser.
If you use an advanced method instead of Natural, you can get an array with multiples winners.
Throw an exception on error.
---------------------------------------
### Related method(s)
* [Election::getCondorcetWinner](../Election%20Class/public%20Election--getCondorcetWinner.md)
* [Election::getLoser](../Election%20Class/public%20Election--getLoser.md)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Manual - Natural Condorcet](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-1.-Natural-Condorcet)**

View File

@ -0,0 +1,30 @@
## public Election::isRegisteredCandidate
### Description
```php
public Election->isRegisteredCandidate ( CondorcetPHP\Condorcet\Candidate|string $candidate [, bool $strictMode = true] ): bool
```
Check if a candidate is already taking part in the election.
##### **candidate:** *```CondorcetPHP\Condorcet\Candidate|string```*
Candidate object or candidate string name. String name works only if the strict mode is active.
##### **strictMode:** *```bool```*
Search comparison mode. In strict mode, candidate objects are compared strictly and a string input can't match anything.
If strict mode is false, the comparison will be based on name.
### Return value:
*(```bool```)* True / False
---------------------------------------
### Related method(s)
* [Election::addCandidate](../Election%20Class/public%20Election--addCandidate.md)

View File

@ -0,0 +1,22 @@
## public Election::isVoteWeightAllowed
### Description
```php
public Election->isVoteWeightAllowed ( ): bool
```
Returns the corresponding setting as currently set (False by default).
If it is True then votes vote optionally can use weight otherwise (if false) all votes will be evaluated as equal for this election.
### Return value:
*(```bool```)* True / False
---------------------------------------
### Related method(s)
* [Election::allowsVoteWeight](../Election%20Class/public%20Election--allowsVoteWeight.md)

View File

@ -0,0 +1,43 @@
## public Election::parseCandidates
### Description
```php
public Election->parseCandidates ( string $input [, bool $isFile = false] ): array
```
Import candidate from a text source.
##### **input:** *```string```*
String or valid path to a text file.
##### **isFile:** *```bool```*
If true, the input is evaluated as path to a text file.
### Return value:
*(```array```)* List of newly registered candidate object. Count it for checking if all candidates have been correctly registered.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\CandidateExistsException```
* ```CondorcetPHP\Condorcet\Throwable\VoteMaxNumberReachedException```
---------------------------------------
### Related method(s)
* [Election::addCandidate](../Election%20Class/public%20Election--addCandidate.md)
* [Election::addCandidatesFromJson](../Election%20Class/public%20Election--addCandidatesFromJson.md)
* [Election::parseVotes](../Election%20Class/public%20Election--parseVotes.md)
---------------------------------------
### Examples and explanation
* **[Manual - Manage Candidates](https://github.com/julien-boudry/Condorcet/wiki/II-%23-A.-Create-an-Election-%23-2.-Create-Candidates)**

View File

@ -0,0 +1,38 @@
## public Election::parseVotes
### Description
```php
public Election->parseVotes ( string $input [, bool $isFile = false] ): int
```
Import votes from a text source. If any invalid vote is found inside, nothing are registered.
##### **input:** *```string```*
String or valid path to a text file.
##### **isFile:** *```bool```*
If true, the input is evalatued as path to text file.
### Return value:
*(```int```)* Count of the new registered vote.
---------------------------------------
### Related method(s)
* [Election::addVote](../Election%20Class/public%20Election--addVote.md)
* [Election::parseCandidates](../Election%20Class/public%20Election--parseCandidates.md)
* [Election::parseVotesWithoutFail](../Election%20Class/public%20Election--parseVotesWithoutFail.md)
* [Election::addVotesFromJson](../Election%20Class/public%20Election--addVotesFromJson.md)
---------------------------------------
### Examples and explanation
* **[Manual - Add Vote](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote)**

View File

@ -0,0 +1,42 @@
## public Election::parseVotesWithoutFail
### Description
```php
public Election->parseVotesWithoutFail ( SplFileInfo|string $input [, bool $isFile = false , ?Closure $callBack = null] ): int
```
Similar to parseVote method. But will ignore invalid line. This method is also far less greedy in memory and must be prefered for very large file input. And to combine with the use of an external data handler.
##### **input:** *```SplFileInfo|string```*
String, valid path to a text file or an object SplFileInfo or extending it like SplFileObject.
##### **isFile:** *```bool```*
If true, the string input is evalatued as path to text file.
##### **callBack:** *```?Closure```*
Callback function to execute after each registered vote.
### Return value:
*(```int```)* Number of invalid records into input (except empty lines). It's not an invalid votes count. Check Election::countVotes if you want to be sure.
---------------------------------------
### Related method(s)
* [Election::addVote](../Election%20Class/public%20Election--addVote.md)
* [Election::parseCandidates](../Election%20Class/public%20Election--parseCandidates.md)
* [Election::parseVotes](../Election%20Class/public%20Election--parseVotes.md)
* [Election::addVotesFromJson](../Election%20Class/public%20Election--addVotesFromJson.md)
---------------------------------------
### Examples and explanation
* **[Manual - Add Vote](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-1.-Add-Vote)**

View File

@ -0,0 +1,43 @@
## public Election::removeCandidates
### Description
```php
public Election->removeCandidates ( CondorcetPHP\Condorcet\Candidate|array|string $candidates_input ): array
```
Remove candidates from an election.
*Please note: You can't remove candidates after the first vote. An exception will be thrown.*
##### **candidates_input:** *```CondorcetPHP\Condorcet\Candidate|array|string```*
* String matching candidate name
* CondorcetPHP\Condorcet\Candidate object
* Array populated by CondorcetPHP\Condorcet\Candidate
* Array populated by string matching candidate name.
### Return value:
*(```array```)* List of removed CondorcetPHP\Condorcet\Candidate object.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\CandidateDoesNotExistException```
* ```CondorcetPHP\Condorcet\Throwable\VotingHasStartedException```
---------------------------------------
### Related method(s)
* [Election::addCandidate](../Election%20Class/public%20Election--addCandidate.md)
* [Election::getCandidatesList](../Election%20Class/public%20Election--getCandidatesList.md)
---------------------------------------
### Examples and explanation
* **[Manual - Manage Candidate](https://github.com/julien-boudry/Condorcet/wiki/II-%23-A.-Create-an-Election-%23-2.-Create-Candidates)**

View File

@ -0,0 +1,26 @@
## public Election::removeExternalDataHandler
### Description
```php
public Election->removeExternalDataHandler ( ): bool
```
Remove an external driver to store vote on very large election. And import his data into classical memory.
### Return value:
*(```bool```)* True if success. Else throw an Exception.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\DataHandlerException```
---------------------------------------
### Related method(s)
* [Election::setExternalDataHandler](../Election%20Class/public%20Election--setExternalDataHandler.md)

View File

@ -0,0 +1,33 @@
## public Election::removeVote
### Description
```php
public Election->removeVote ( CondorcetPHP\Condorcet\Vote $vote ): bool
```
Remove Votes from an election.
##### **vote:** *```CondorcetPHP\Condorcet\Vote```*
Vote object.
### Return value:
*(```bool```)* List of removed CondorcetPHP\Condorcet\Vote object.
---------------------------------------
### Related method(s)
* [Election::addVote](../Election%20Class/public%20Election--addVote.md)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)
* [Election::removeVotesByTags](../Election%20Class/public%20Election--removeVotesByTags.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote management](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-2.-Manage-Vote)**

View File

@ -0,0 +1,44 @@
## public Election::removeVotesByTags
### Description
```php
public Election->removeVotesByTags ( array|string $tags [, bool $with = true] ): array
```
Remove Vote from an election using tags.
```php
$election->removeVotesByTags('Charlie') ; // Remove vote(s) with tag Charlie
$election->removeVotesByTags('Charlie', false) ; // Remove votes without tag Charlie
$election->removeVotesByTags('Charlie, Julien', false) ; // Remove votes without tag Charlie AND without tag Julien.
$election->removeVotesByTags(array('Julien','Charlie')) ; // Remove votes with tag Charlie OR with tag Julien.
```
##### **tags:** *```array|string```*
Tags as string separated by commas or array.
##### **with:** *```bool```*
Votes with these tags or without.
### Return value:
*(```array```)* List of removed CondorcetPHP\Condorcet\Vote object.
---------------------------------------
### Related method(s)
* [Election::addVote](../Election%20Class/public%20Election--addVote.md)
* [Election::getVotesList](../Election%20Class/public%20Election--getVotesList.md)
* [Election::removeVotes](../Election%20Class/public%20Election--removeVotes.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote management](https://github.com/julien-boudry/Condorcet/wiki/II-%23-B.-Vote-management-%23-2.-Manage-Vote)**

View File

@ -0,0 +1,36 @@
## public Election::setExternalDataHandler
### Description
```php
public Election->setExternalDataHandler ( CondorcetPHP\Condorcet\DataManager\DataHandlerDrivers\DataHandlerDriverInterface $driver ): bool
```
Import and enable an external driver to store vote on very large election.
##### **driver:** *```CondorcetPHP\Condorcet\DataManager\DataHandlerDrivers\DataHandlerDriverInterface```*
Driver object.
### Return value:
*(```bool```)* True if success. Else throw an Exception.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\DataHandlerException```
---------------------------------------
### Related method(s)
* [Election::removeExternalDataHandler](../Election%20Class/public%20Election--removeExternalDataHandler.md)
---------------------------------------
### Examples and explanation
* **[[Manual - DataHandler]](https://github.com/julien-boudry/Condorcet/blob/master/examples/specifics_examples/use_large_election_external_database_drivers.php)**

View File

@ -0,0 +1,27 @@
## public Election::setImplicitRanking
### Description
```php
public Election->setImplicitRanking ( [bool $rule = true] ): bool
```
Set the setting and reset all result data.
If it is True then all votes expressing a partial ranking are understood as implicitly placing all the non-mentioned candidates exequos on a last rank.
If it is false, then the candidates not ranked, are not taken into account at all.
##### **rule:** *```bool```*
New rule.
### Return value:
*(```bool```)* Return True
---------------------------------------
### Related method(s)
* [Election::getImplicitRankingRule](../Election%20Class/public%20Election--getImplicitRankingRule.md)

View File

@ -0,0 +1,33 @@
## public Election::setMethodOption
### Description
```php
public Election->setMethodOption ( string $method , string $optionName , BackedEnum|array|string|int|float $optionValue ): bool
```
Set an option to a method module and reset his cache for this election object. Be aware that this option applies to all election objects and remains in memory.
##### **method:** *```string```*
Method name or class path.
##### **optionName:** *```string```*
Option name.
##### **optionValue:** *```BackedEnum|array|string|int|float```*
Option Value.
### Return value:
*(```bool```)* True on success. Else False.
---------------------------------------
### Related method(s)
* [Result::getMethodOptions](../Result%20Class/public%20Result--getMethodOptions.md)

View File

@ -0,0 +1,30 @@
## public Election::setNumberOfSeats
### Description
```php
public Election->setNumberOfSeats ( int $seats ): int
```
Set number of Seats for STV methods.
##### **seats:** *```int```*
The number of seats for proportional methods.
### Return value:
*(```int```)* Number of seats.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\NoSeatsException```
---------------------------------------
### Related method(s)
* [Election::getNumberOfSeats](../Election%20Class/public%20Election--getNumberOfSeats.md)

View File

@ -0,0 +1,31 @@
## public Election::setStateToVote
### Description
```php
public Election->setStateToVote ( ): bool
```
Force the election to get back to state 2. See Election::getState.
It is not necessary to use this method. The election knows how to manage its phase changes on its own. But it is a way to clear the cache containing the results of the methods.
If you are on state 1 (candidate registering), it's will close this state and prepare election to get firsts votes.
If you are on state 3. The method result cache will be clear, but not the pairwise. Which will continue to be updated dynamically.
### Return value:
*(```bool```)* Always True.
### Throws:
* ```CondorcetPHP\Condorcet\Throwable\NoCandidatesException```
* ```CondorcetPHP\Condorcet\Throwable\ResultRequestedWithoutVotesException```
---------------------------------------
### Related method(s)
* [Election::getState](../Election%20Class/public%20Election--getState.md)

View File

@ -0,0 +1,20 @@
## public Election::setStatsVerbosity
### Description
```php
public Election->setStatsVerbosity ( CondorcetPHP\Condorcet\Algo\StatsVerbosity $StatsVerbosity ): void
```
Set a verbosity level for Result->statsVerbosity on returning Result objects. High level can slow down processing and use more memory (many more) than LOW and STD (default) level on somes methods.
##### **StatsVerbosity:** *```CondorcetPHP\Condorcet\Algo\StatsVerbosity```*
A verbosity level.
---------------------------------------
### Related method(s)
* [Election::getVerbosity](../Election%20Class/public%20Election--getVerbosity.md)
* [Result::getVerbosity](../Result%20Class/public%20Result--getVerbosity.md)

View File

@ -0,0 +1,22 @@
## public Election::sumValidVotesWeightWithConstraints
### Description
```php
public Election->sumValidVotesWeightWithConstraints ( ): int
```
Sum total votes weight in this election. If vote weight functionality is disable (default setting), it will return the number of registered votes. This method don't ignore votes constraints, only valid vote will be counted.
### Return value:
*(```int```)* (Int) Total vote weight
---------------------------------------
### Related method(s)
* [Election::countValidVoteWithConstraints](../Election%20Class/public%20Election--countValidVoteWithConstraints.md)
* [Election::countInvalidVoteWithConstraints](../Election%20Class/public%20Election--countInvalidVoteWithConstraints.md)

View File

@ -0,0 +1,21 @@
## public Election::sumVotesWeight
### Description
```php
public Election->sumVotesWeight ( ): int
```
Sum total votes weight in this election. If vote weight functionality is disable (default setting), it will return the number of registered votes. This method ignore votes constraints.
### Return value:
*(```int```)* (Int) Total vote weight
---------------------------------------
### Related method(s)
* [Election::sumValidVotesWeightWithConstraints](../Election%20Class/public%20Election--sumValidVotesWeightWithConstraints.md)

View File

@ -0,0 +1,33 @@
## public Election::testIfVoteIsValidUnderElectionConstraints
### Description
```php
public Election->testIfVoteIsValidUnderElectionConstraints ( CondorcetPHP\Condorcet\Vote $vote ): bool
```
Test if a vote is valid with these election constraints.
##### **vote:** *```CondorcetPHP\Condorcet\Vote```*
A vote. Not necessarily registered in this election.
### Return value:
*(```bool```)* Return True if vote will pass the constraints rules, else False.
---------------------------------------
### Related method(s)
* [Election::getConstraints](../Election%20Class/public%20Election--getConstraints.md)
* [Election::addConstraints](../Election%20Class/public%20Election--addConstraints.md)
* [Election::clearConstraints](../Election%20Class/public%20Election--clearConstraints.md)
---------------------------------------
### Examples and explanation
* **[Manual - Vote Constraints](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-5.-Vote-Constraints)**

View File

@ -0,0 +1,25 @@
## public static Election::setMaxParseIteration
### Description
```php
public static Election::setMaxParseIteration ( ?int $maxParseIterations ): ?int
```
Maximum input for each use of Election::parseCandidate && Election::parseVote. Will throw an exception if exceeded.
##### **maxParseIterations:** *```?int```*
Null will deactivate this functionality. Else, enter an integer.
### Return value:
*(```?int```)* *(int or null)* The new limit.
---------------------------------------
### Related method(s)
* [static Election::setMaxVoteNumber](../Election%20Class/public%20static%20Election--setMaxVoteNumber.md)

View File

@ -0,0 +1,25 @@
## public static Election::setMaxVoteNumber
### Description
```php
public static Election::setMaxVoteNumber ( ?int $maxVotesNumber ): ?int
```
Add a limitation on Election::addVote and related methods. You can't add new vote y the number of registered vote is equall ou superior of this limit.
##### **maxVotesNumber:** *```?int```*
Null will deactivate this functionality. An integer will fix the limit.
### Return value:
*(```?int```)* *(int or null)* The new limit.
---------------------------------------
### Related method(s)
* [static Election::setMaxParseIteration](../Election%20Class/public%20static%20Election--setMaxParseIteration.md)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
## public Result::getBuildTimeStamp
### Description
```php
public Result->getBuildTimeStamp ( ): float
```
Get the timestamp of this result.
### Return value:
*(```float```)* Microsecond timestamp.

View File

@ -0,0 +1,21 @@
## public Result::getClassGenerator
### Description
```php
public Result->getClassGenerator ( ): string
```
Get the The algorithmic method used for this result.
### Return value:
*(```string```)* Method class path like CondorcetPHP\Condorcet\Algo\Methods\Copeland
---------------------------------------
### Related method(s)
* [Result::getMethod](../Result%20Class/public%20Result--getMethod.md)

View File

@ -0,0 +1,15 @@
## public Result::getCondorcetElectionGeneratorVersion
### Description
```php
public Result->getCondorcetElectionGeneratorVersion ( ): string
```
Get the Condorcet PHP version that build this Result.
### Return value:
*(```string```)* Condorcet PHP version string format.

View File

@ -0,0 +1,22 @@
## public Result::getCondorcetLoser
### Description
```php
public Result->getCondorcetLoser ( ): ?CondorcetPHP\Condorcet\Candidate
```
Get the Condorcet loser, if exist, at the result time.
### Return value:
*(```?CondorcetPHP\Condorcet\Candidate```)* Condorcet/Candidate object if there is a Condorcet loser or NULL instead.
---------------------------------------
### Related method(s)
* [Result::getCondorcetWinner](../Result%20Class/public%20Result--getCondorcetWinner.md)
* [Election::getLoser](../Election%20Class/public%20Election--getLoser.md)

View File

@ -0,0 +1,22 @@
## public Result::getCondorcetWinner
### Description
```php
public Result->getCondorcetWinner ( ): ?CondorcetPHP\Condorcet\Candidate
```
Get the Condorcet winner, if exist, at the result time.
### Return value:
*(```?CondorcetPHP\Condorcet\Candidate```)* CondorcetPHP\Condorcet\Candidate object if there is a Condorcet winner or NULL instead.
---------------------------------------
### Related method(s)
* [Result::getCondorcetLoser](../Result%20Class/public%20Result--getCondorcetLoser.md)
* [Election::getWinner](../Election%20Class/public%20Election--getWinner.md)

View File

@ -0,0 +1,23 @@
## public Result::getLoser
### Description
```php
public Result->getLoser ( ): CondorcetPHP\Condorcet\Candidate|array|null
```
Equivalent to [Condorcet/Election::getWinner($method)](../Election Class/public Election--getWinner.md).
### Return value:
*(```CondorcetPHP\Condorcet\Candidate|array|null```)* Candidate object given. Null if there are no available loser.
You can get an array with multiples losers.
---------------------------------------
### Related method(s)
* [Result::getWinner](../Result%20Class/public%20Result--getWinner.md)
* [Election::getLoser](../Election%20Class/public%20Election--getLoser.md)

View File

@ -0,0 +1,21 @@
## public Result::getMethod
### Description
```php
public Result->getMethod ( ): string
```
Get the The algorithmic method used for this result.
### Return value:
*(```string```)* Method name.
---------------------------------------
### Related method(s)
* [Result::getClassGenerator](../Result%20Class/public%20Result--getClassGenerator.md)

View File

@ -0,0 +1,21 @@
## public Result::getMethodOptions
### Description
```php
public Result->getMethodOptions ( ): array
```
Return the method options.
### Return value:
*(```array```)* Array of options. Can be empty for most of the methods.
---------------------------------------
### Related method(s)
* [Result::getClassGenerator](../Result%20Class/public%20Result--getClassGenerator.md)

View File

@ -0,0 +1,22 @@
## public Result::getNumberOfSeats
### Description
```php
public Result->getNumberOfSeats ( ): ?int
```
Get number of Seats for STV methods result.
### Return value:
*(```?int```)* Number of seats if this result is a STV method. Else NULL.
---------------------------------------
### Related method(s)
* [Election::setNumberOfSeats](../Election%20Class/public%20Election--setNumberOfSeats.md)
* [Election::getNumberOfSeats](../Election%20Class/public%20Election--getNumberOfSeats.md)

View File

@ -0,0 +1,25 @@
## public Result::getObjectVersion
### Description
```php
public Result->getObjectVersion ( [bool $major = false] ): string
```
Get the Condorcet PHP version who built this Election object. Usefull pour serializing Election.
##### **major:** *```bool```*
true will return : '2.0' and false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [static Condorcet::getVersion](../Condorcet%20Class/public%20static%20Condorcet--getVersion.md)

View File

@ -0,0 +1,25 @@
## public Result::getOriginalResultArrayWithString
### Description
```php
public Result->getOriginalResultArrayWithString ( ): array
```
Get result as an array
### Return value:
*(```array```)* Unlike other methods to recover the result. This is frozen as soon as the original creation of the Result object is created.
Candidate objects are therefore protected from any change of candidateName, since the candidate objects are converted into a string when the results are promulgated.
This control method can therefore be useful if you undertake suspicious operations on candidate objects after the results have been promulgated.
---------------------------------------
### Related method(s)
* [Result::getResultAsArray](../Result%20Class/public%20Result--getResultAsArray.md)
* [Result::getResultAsString](../Result%20Class/public%20Result--getResultAsString.md)

View File

@ -0,0 +1,26 @@
## public Result::getResultAsArray
### Description
```php
public Result->getResultAsArray ( [bool $convertToString = false] ): array
```
Get result as an array
##### **convertToString:** *```bool```*
Convert Candidate object to string.
### Return value:
*(```array```)* An ordered multidimensionnal array by rank.
---------------------------------------
### Related method(s)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
* [Result::getResultAsString](../Result%20Class/public%20Result--getResultAsString.md)

View File

@ -0,0 +1,22 @@
## public Result::getResultAsString
### Description
```php
public Result->getResultAsString ( ): string
```
Get result as string
### Return value:
*(```string```)* Result ranking as string.
---------------------------------------
### Related method(s)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
* [Result::getResultAsArray](../Result%20Class/public%20Result--getResultAsArray.md)

View File

@ -0,0 +1,27 @@
## public Result::getStats
### Description
```php
public Result->getStats ( ): mixed
```
Get advanced computing data from used algorithm. Like Strongest paths for Schulze method.
### Return value:
*(```mixed```)* Varying according to the algorithm used.
---------------------------------------
### Related method(s)
* [Election::getResult](../Election%20Class/public%20Election--getResult.md)
---------------------------------------
### Examples and explanation
* **[Advanced Result Management](https://github.com/julien-boudry/Condorcet/wiki/II-%23-C.-Result-%23-3.-Advanced-Results-Management)**

View File

@ -0,0 +1,19 @@
## public Result::getWarning
### Description
```php
public Result->getWarning ( [?int $type = null] ): array
```
From native methods: only Kemeny-Young use it to inform about a conflict during the computation process.
##### **type:** *```?int```*
Filter on a specific warning type code.
### Return value:
*(```array```)* Warnings provided by the by the method that generated the warning. Empty array if there is not.

View File

@ -0,0 +1,23 @@
## public Result::getWinner
### Description
```php
public Result->getWinner ( ): CondorcetPHP\Condorcet\Candidate|array|null
```
Equivalent to [Condorcet/Election::getWinner($method)](../Election Class/public Election--getWinner.md).
### Return value:
*(```CondorcetPHP\Condorcet\Candidate|array|null```)* Candidate object given. Null if there are no available winner.
You can get an array with multiples winners.
---------------------------------------
### Related method(s)
* [Result::getLoser](../Result%20Class/public%20Result--getLoser.md)
* [Election::getWinner](../Election%20Class/public%20Election--getWinner.md)

View File

@ -0,0 +1,15 @@
## public Result::isProportional
### Description
```php
public Result->isProportional ( ): bool
```
Does the result come from a proportional method
---------------------------------------
### Related method(s)
* [Result::getNumberOfSeats](../Result%20Class/public%20Result--getNumberOfSeats.md)

View File

@ -0,0 +1,21 @@
## public Timer\Manager::getHistory
### Description
```php
public Timer\Manager->getHistory ( ): array
```
Return benchmarked actions history.
### Return value:
*(```array```)* An explicit array with history.
---------------------------------------
### Related method(s)
* [Election::getTimerManager](../Election%20Class/public%20Election--getTimerManager.md)

View File

@ -0,0 +1,25 @@
## public Timer\Manager::getObjectVersion
### Description
```php
public Timer\Manager->getObjectVersion ( [bool $major = false] ): string
```
Get the Condorcet PHP version who built this Election object. Usefull pour serializing Election.
##### **major:** *```bool```*
true will return : '2.0' and false will return : '2.0.0'.
### Return value:
*(```string```)* Condorcet PHP version.
---------------------------------------
### Related method(s)
* [static Condorcet::getVersion](../Condorcet%20Class/public%20static%20Condorcet--getVersion.md)

View File

@ -0,0 +1,13 @@
## public Tools\Converters\CondorcetElectionFormat::__construct
### Description
```php
public Tools\Converters\CondorcetElectionFormat->__construct ( SplFileInfo|string $input )
```
Read a Condorcet format file, usually using .cvotes file extension
##### **input:** *```SplFileInfo|string```*
String, valid path to a text file or an object SplFileInfo or extending it like SplFileObject.

Some files were not shown because too many files have changed in this diff Show More