@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | namespace AppBundle\Utils; |
| 4 | 4 | |
| 5 | 5 | use AppBundle\Entity\{ |
| 6 | - Choice, Poll, PollType |
|
| 6 | + Choice, Poll, PollType |
|
| 7 | 7 | }; |
| 8 | 8 | use Doctrine\Common\Persistence\ManagerRegistry; |
| 9 | 9 | |
@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | protected $doctrineRegistry; |
| 13 | 13 | protected $electionManager; |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @param \Doctrine\Common\Persistence\ManagerRegistry $doctrineRegistry |
|
| 19 | - * @param \AppBundle\Utils\ElectionManager $electionManager |
|
| 20 | - */ |
|
| 21 | - public function __construct(ManagerRegistry $doctrineRegistry, ElectionManager $electionManager) |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @param \Doctrine\Common\Persistence\ManagerRegistry $doctrineRegistry |
|
| 19 | + * @param \AppBundle\Utils\ElectionManager $electionManager |
|
| 20 | + */ |
|
| 21 | + public function __construct(ManagerRegistry $doctrineRegistry, ElectionManager $electionManager) |
|
| 22 | 22 | { |
| 23 | 23 | $this->doctrineRegistry = $doctrineRegistry; |
| 24 | 24 | $this->electionManager = $electionManager; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function getPolls($sort, boolean $current = false): array |
|
| 28 | - { |
|
| 29 | - if ($current) { |
|
| 30 | - return $this->getCurrentPolls(); |
|
| 31 | - } |
|
| 32 | - } |
|
| 27 | + public function getPolls($sort, boolean $current = false): array |
|
| 28 | + { |
|
| 29 | + if ($current) { |
|
| 30 | + return $this->getCurrentPolls(); |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Get an array of current polls (objects). |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function getCurrentPolls(): array |
| 40 | 40 | { |
| 41 | - $currentPolls = $this->doctrineRegistry->getManager()->getRepository('AppBundle:Poll')->findByActive(true); |
|
| 41 | + $currentPolls = $this->doctrineRegistry->getManager()->getRepository('AppBundle:Poll')->findByActive(true); |
|
| 42 | 42 | |
| 43 | 43 | return $currentPolls; |
| 44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getAllPolls(): array |
| 64 | 64 | { |
| 65 | - $polls = $this->doctrineRegistry->getManager()->getRepository('AppBundle:Poll')->findAll(); |
|
| 65 | + $polls = $this->doctrineRegistry->getManager()->getRepository('AppBundle:Poll')->findAll(); |
|
| 66 | 66 | |
| 67 | 67 | return $polls; |
| 68 | 68 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | return []; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Get the result of the poll (in terms of a choice). |
|
| 87 | - * |
|
| 88 | - * @param Poll $poll |
|
| 89 | - * |
|
| 90 | - * @return \AppBundle\Entity\Choice |
|
| 91 | - */ |
|
| 85 | + /** |
|
| 86 | + * Get the result of the poll (in terms of a choice). |
|
| 87 | + * |
|
| 88 | + * @param Poll $poll |
|
| 89 | + * |
|
| 90 | + * @return \AppBundle\Entity\Choice |
|
| 91 | + */ |
|
| 92 | 92 | public function getPollResult(Poll $poll): Choice |
| 93 | 93 | { |
| 94 | 94 | // If election then call Election Manager |