protected function composeView($scope = '', $data = array(), $template = '', $extension = '')
    {
        if (!is_array($data)) {
            $data = [];
        }

        if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
            $this->returnJson([
                'success' => true,
                'data' => $data,
            ]);
        } else {
            foreach ($data as $key => $value) {
                if (is_array($value) || is_object($value)) {
                    $data[$key] = json_encode($value);
                }
            }
            $this->setData('data', $data);
            $this->setPage($scope, $template, $extension);
        }
    }