public function getResult ($method = true, array $options = []) : Result
    {
        $options = self::formatResultOptions($options);

        // Filter if tag is provided & return
        if ($options['%tagFilter']) :
            $chrono = new Timer_Chrono ($this->_timer, 'GetResult with filter');

            $filter = new self;

            foreach ($this->getCandidatesList() as $candidate) :
                $filter->addCandidate($candidate);
            endforeach;

            foreach ($this->getVotesList($options['tags'], $options['withTag']) as $vote) :
                $filter->addVote($vote);
            endforeach;

            unset($chrono);

            return $filter->getResult($method);
        endif;

            ////// Start //////

        // Prepare
        $this->prepareResult();

            //////

        $chrono = new Timer_Chrono ($this->_timer);

        if ($method === true) :
            $this->initResult(Condorcet::getDefaultMethod());
            $result = $this->_Calculator[Condorcet::getDefaultMethod()]->getResult();
        elseif ($method = Condorcet::isAuthMethod((string) $method)) :
            $this->initResult($method);
            $result = $this->_Calculator[$method]->getResult();
        else :
            throw new CondorcetException(8,$method);
        endif;

        $chrono->setRole('GetResult for '.$method);

        return $result;
    }
public function getResult ($method = true, array $options = []) : Result
    {
        $options = self::formatResultOptions($options);

        // Filter if tag is provided & return
        if ($options['%tagFilter']) :
            $chrono = new Timer_Chrono ($this->_timer, 'GetResult with filter');

            $filter = new self;

            foreach ($this->getCandidatesList() as $candidate) :
                $filter->addCandidate($candidate);
            endforeach;

            foreach ($this->getVotesList($options['tags'], $options['withTag']) as $vote) :
                $filter->addVote($vote);
            endforeach;

            unset($chrono);

            return $filter->getResult($method);
        endif;

            ////// Start //////

        // Prepare
        $this->prepareResult();

            //////

        $chrono = new Timer_Chrono ($this->_timer);

        if ($method === true) :
            $this->initResult(Condorcet::getDefaultMethod());
            $result = $this->_Calculator[Condorcet::getDefaultMethod()]->getResult();
        elseif ($method = Condorcet::isAuthMethod((string) $method)) :
            $this->initResult($method);
            $result = $this->_Calculator[$method]->getResult();
        else :
            throw new CondorcetException(8,$method);
        endif;

        $chrono->setRole('GetResult for '.$method);

        return $result;
    }
public function getResult ( $ method = true , array $ options = [ ] ) : Result { $ options = self :: formatResultOptions ( $ options ) ; // Filter if tag is provided & return if ( $ options [ '%tagFilter' ] ) : $ chrono = new Timer_Chrono ( $ this -> _timer , 'GetResult with filter' ) ; $ filter = new self ; foreach ( $ this -> getCandidatesList ( ) as $ candidate ) : $ filter -> addCandidate ( $ candidate ) ; endforeach ; foreach ( $ this -> getVotesList ( $ options [ 'tags' ] , $ options [ 'withTag' ] ) as $ vote ) : $ filter -> addVote ( $ vote ) ; endforeach ; unset ( $ chrono ) ; return $ filter -> getResult ( $ method ) ; endif ; ////// Start ////// // Prepare $ this -> prepareResult ( ) ; ////// $ chrono = new Timer_Chrono ( $ this -> _timer ) ; if ( $ method === true ) : $ this -> initResult ( Condorcet :: getDefaultMethod ( ) ) ; $ result = $ this -> _Calculator [ Condorcet :: getDefaultMethod ( ) ] -> getResult ( ) ; elseif ( $ method = Condorcet :: isAuthMethod ( ( string ) $ method ) ) : $ this -> initResult ( $ method ) ; $ result = $ this -> _Calculator [ $ method ] -> getResult ( ) ; else : throw new CondorcetException ( 8 , $ method ) ; endif ; $ chrono -> setRole ( 'GetResult for ' . $ method ) ; return $ result ; }
Generic function for default result with ability to change default object method
Generic function for default result with ability to change default object method