test adding condorcet vote
This commit is contained in:
@ -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)**
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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.
|
||||
|
@ -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)
|
@ -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)
|
@ -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```
|
Reference in New Issue
Block a user