The workflow
Election Cycle
Classical Flow
- Add candidates-- When you add your first vote, you will never be able to change the candidate list without starting a new election. --
- Add votes Note that a same vote object can take part in multiple elections simultaneously.
- Get the results from one or multiple methods. If you don't change the vote list, you can enjoy the cache engine. Else cache it's clear.
Get the state
Reference
You can change votes at any time. The results cache will be flush (but the results objects you get are still available and immutable) and the vote interpretation will be re-evaluated.
php
use CondorcetPHP\Condorcet\Election;
$election = new Election;
$election->state; // You don't need to set a state. This is informational.