| 1 | <?php |
||
| 18 | abstract class Method |
||
| 19 | { |
||
| 20 | use CondorcetVersion; |
||
| 21 | |||
| 22 | public static $_maxCandidates = null; |
||
| 23 | |||
| 24 | protected $_selfElection; |
||
| 25 | protected $_Result; |
||
| 26 | |||
| 27 | 67 | public function __construct (Election $mother) |
|
| 28 | { |
||
| 29 | 67 | $this->_selfElection = $mother; |
|
| 30 | |||
| 31 | 67 | if (!is_null(static::$_maxCandidates) && $this->_selfElection->countCandidates() > static::$_maxCandidates) : |
|
| 32 | 2 | throw new CondorcetException(101, static::METHOD_NAME[0].' is configured to accept only '.static::$_maxCandidates.' candidates'); |
|
| 33 | endif; |
||
| 34 | 65 | } |
|
| 35 | |||
| 36 | abstract protected function getStats () : array; |
||
| 37 | |||
| 38 | 58 | protected function createResult (array $result) : Result |
|
| 48 | } |
||
| 49 |