/** * This method create output for response. * * @access protected * @param string $sContent * @return Response * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function createResponseString($sContent) { if ($this->bResponseAsJson) { // if response should be a JSON $sResponse = json_encode(['status' => $this->sStatus, 'content' => $sContent]); die($sResponse); } else { // if response is a simple string // create response $oResponse = new Response(); $oResponse->setContent($sContent); return $oResponse; } }
/** * Create independent response. * * @static * @author Krzysztof Trzos * @access public * @param View $oContent * @return string * @since 1.0.0-alpha * @version 1.0.0-alpha */ public static function independentResponse(View $oContent) { $sContent = $oContent->render(); $oResponse = new Response(); $oResponse->setContent($sContent); return $oResponse; }