PhpSlackBot\Command\PokerPlanningCommand::end PHP Метод

end() приватный Метод

private end ( )
    private function end()
    {
        if ($this->status == 'running') {
            if ($this->getCurrentUser() == $this->initiator) {
                $message = 'Ending session' . (!is_null($this->subject) ? ' for ' . $this->subject : '') . "\n" . 'Results : ' . "\n";
                if (empty($this->scores)) {
                    $message .= 'No vote !';
                } else {
                    foreach ($this->scores as $user => $score) {
                        $message .= $this->getUserNameFromUserId($user) . ' => ' . $score . "\n";
                    }
                    $message .= '------------------' . "\n";
                    $message .= 'Average score : ' . $this->getAverageScore() . "\n";
                    $message .= 'Median score : ' . $this->getMedianScore() . "\n";
                    $message .= 'Max score : ' . $this->getMaxScore() . "\n";
                    $message .= 'Min score : ' . $this->getMinScore();
                }
                $this->send($this->getCurrentChannel(), null, $message);
                $this->status = 'free';
            } else {
                $this->send($this->getCurrentChannel(), $this->getCurrentUser(), 'Only ' . $this->getUserNameFromUserId($this->initiator) . ' can end the session');
            }
        } else {
            $this->send($this->getCurrentChannel(), $this->getCurrentUser(), 'There is no poker session. You can start one with "' . $this->getName() . ' start"');
        }
    }