| Conditions | 6 | 
| Paths | 7 | 
| Total Lines | 46 | 
| Code Lines | 27 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 21 | 
| CRAP Score | 6.0033 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 55 | 75 | public function getResult ($method = true, array $options = []) : Result  | 
            |
| 56 |     { | 
            ||
| 57 | 75 | $options = $this->formatResultOptions($options);  | 
            |
| 58 | |||
| 59 | // Filter if tag is provided & return  | 
            ||
| 60 | 75 | if ($options['%tagFilter']) :  | 
            |
| 61 | 2 | $chrono = new Timer_Chrono ($this->_timer, 'GetResult with filter');  | 
            |
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 62 | |||
| 63 | 2 | $filter = new self;  | 
            |
| 64 | |||
| 65 | 2 | foreach ($this->getCandidatesList() as $candidate) :  | 
            |
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 66 | 2 | $filter->addCandidate($candidate);  | 
            |
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 67 | endforeach;  | 
            ||
| 68 | |||
| 69 | 2 | foreach ($this->getVotesList($options['tags'], $options['withTag']) as $vote) :  | 
            |
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 70 | 2 | $filter->addVote($vote);  | 
            |
| 
                                                                                                    
                         1 ignored issue 
                            –
                            show
                         | 
                |||
| 71 | endforeach;  | 
            ||
| 72 | |||
| 73 | 2 | unset($chrono);  | 
            |
| 74 | |||
| 75 | 2 | return $filter->getResult($method);  | 
            |
| 76 | endif;  | 
            ||
| 77 | |||
| 78 | ////// Start //////  | 
            ||
| 79 | |||
| 80 | // Prepare  | 
            ||
| 81 | 75 | $this->prepareResult();  | 
            |
| 82 | |||
| 83 | //////  | 
            ||
| 84 | |||
| 85 | 75 | $chrono = new Timer_Chrono ($this->_timer);  | 
            |
| 86 | |||
| 87 | 75 | if ($method === true) :  | 
            |
| 88 | 7 | $this->initResult(Condorcet::getDefaultMethod());  | 
            |
| 89 | 7 | $result = $this->_Calculator[Condorcet::getDefaultMethod()]->getResult();  | 
            |
| 90 | 71 | elseif ($method = Condorcet::isAuthMethod((string) $method)) :  | 
            |
| 91 | 71 | $this->initResult($method);  | 
            |
| 92 | 69 | $result = $this->_Calculator[$method]->getResult();  | 
            |
| 93 | else :  | 
            ||
| 94 | throw new CondorcetException(8,$method);  | 
            ||
| 95 | endif;  | 
            ||
| 96 | |||
| 97 | 72 |         $chrono->setRole('GetResult for '.$method); | 
            |
| 98 | |||
| 99 | 72 | return $result;  | 
            |
| 100 | }  | 
            ||
| 101 | |||
| 221 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: