| 1 | <?php |
||
| 15 | trait Linkable |
||
| 16 | { |
||
| 17 | private $_link = []; |
||
| 18 | |||
| 19 | 1 | public function __clone () |
|
| 20 | { |
||
| 21 | 1 | $this->destroyAllLink(); |
|
| 22 | 1 | } |
|
| 23 | |||
| 24 | 88 | public function haveLink (Election $election) : bool |
|
| 28 | |||
| 29 | 100 | public function countLinks () : int |
|
| 33 | |||
| 34 | 100 | public function getLinks () : ?array |
|
| 38 | |||
| 39 | // Internal |
||
| 40 | # Dot not Overloading ! Do not Use ! |
||
| 41 | |||
| 42 | 114 | public function registerLink (Election $election) : void |
|
| 49 | |||
| 50 | 11 | public function destroyLink (Election $election) : bool |
|
| 51 | { |
||
| 52 | 11 | $destroyKey = array_search($election, $this->_link, true); |
|
| 53 | |||
| 54 | 11 | if ($destroyKey !== false) : |
|
| 55 | 10 | unset($this->_link[$destroyKey]); |
|
| 56 | 10 | return true; |
|
| 57 | else : |
||
| 58 | 7 | return false; |
|
| 59 | endif; |
||
| 60 | } |
||
| 61 | |||
| 62 | 3 | protected function destroyAllLink () : void |
|
| 66 | } |
||
| 67 |