phpbb\install\helper\iohandler\ajax_iohandler::prepare_json_array PHP Method

prepare_json_array() protected method

Prepares iohandler's data to be sent out to the client.
protected prepare_json_array ( boolean $no_more_output = false ) : array
$no_more_output boolean Whether or not there will be more output in this response
return array
    protected function prepare_json_array($no_more_output = false)
    {
        $json_array = array();
        if (!empty($this->errors)) {
            $json_array['errors'] = $this->errors;
            $this->errors = array();
        }
        if (!empty($this->warnings)) {
            $json_array['warnings'] = $this->warnings;
            $this->warnings = array();
        }
        if (!empty($this->logs)) {
            $json_array['logs'] = $this->logs;
            $this->logs = array();
        }
        if (!empty($this->success)) {
            $json_array['success'] = $this->success;
            $this->success = array();
        }
        if (!empty($this->download)) {
            $json_array['download'] = $this->download;
            $this->download = array();
        }
        if (!empty($this->form)) {
            $json_array['form'] = $this->form;
            $this->form = '';
        }
        if (!empty($this->file_status)) {
            $json_array['file_status'] = $this->file_status;
            $this->file_status = '';
        }
        // If current task name is set, we push progress message to the client side
        if (!empty($this->current_task_name)) {
            $json_array['progress'] = array('task_name' => $this->current_task_name, 'task_num' => $this->current_task_progress, 'task_count' => $this->task_progress_count);
            if ($this->restart_progress_bar) {
                $json_array['progress']['restart'] = 1;
                $this->restart_progress_bar = false;
            }
        }
        if (!empty($this->nav_data)) {
            $json_array['nav'] = $this->nav_data;
            $this->nav_data = array();
        }
        if ($this->request_client_refresh) {
            $json_array['refresh'] = true;
            $this->request_client_refresh = false;
        }
        if (!empty($this->cookies)) {
            $json_array['cookies'] = $this->cookies;
            $this->cookies = array();
        }
        if (!empty($this->redirect_url)) {
            $json_array['redirect'] = $this->redirect_url;
            $this->redirect_url = array();
        }
        if ($no_more_output) {
            $json_array['over'] = true;
        }
        return $json_array;
    }