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--addConstraint.md
2022-09-21 14:01:45 +02:00

39 lines
1.0 KiB
Markdown

## 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)**