public function infoPoll()
    {
        $poll = $this->state->poll;
        $voteDir = $this->state->directory . '/votes';
        $poll['count'] = count(scanDir($voteDir))-2;

        if ($poll['opened']) {
            unset($poll['answers']);
        } else {
            $answers = array();
            for ($i=0; $i<$poll['size']; $i++) {
                $answers[$i] = 0;
            }
            foreach (scanDir($voteDir) as $file) {
                if ($file != '.' && $file != '..') {
                    $value = (int)file_get_contents($voteDir . '/' . $file);
                    $answers[$value]++;
                }
            }
            $poll['answers'] = $answers;
        }

        return $poll;
    }
public function infoPoll()
    {
        $poll = $this->state->poll;
        $voteDir = $this->state->directory . '/votes';
        $poll['count'] = count(scanDir($voteDir))-2;

        if ($poll['opened']) {
            unset($poll['answers']);
        } else {
            $answers = array();
            for ($i=0; $i<$poll['size']; $i++) {
                $answers[$i] = 0;
            }
            foreach (scanDir($voteDir) as $file) {
                if ($file != '.' && $file != '..') {
                    $value = (int)file_get_contents($voteDir . '/' . $file);
                    $answers[$value]++;
                }
            }
            $poll['answers'] = $answers;
        }

        return $poll;
    }
public function infoPoll ( ) { $ poll = $ this -> state -> poll ; $ voteDir = $ this -> state -> directory . '/votes' ; $ poll [ 'count' ] = count ( scanDir ( $ voteDir ) ) - 2 ; if ( $ poll [ 'opened' ] ) { unset ( $ poll [ 'answers' ] ) ; } else { $ answers = array ( ) ; for ( $ i = 0 ; $ i < $ poll [ 'size' ] ; $ i ++ ) { $ answers [ $ i ] = 0 ; } foreach ( scanDir ( $ voteDir ) as $ file ) { if ( $ file != '.' && $ file != '..' ) { $ value = ( int ) file_get_contents ( $ voteDir . '/' . $ file ) ; $ answers [ $ value ] ++ ; } } $ poll [ 'answers' ] = $ answers ; } return $ poll ; }
Info for the poll
Info for the poll