public function handleResponse($response)
    {
        switch (true) {
            // Render default template and use $response as template variables
            case is_array($response) :
                $content = $this->view->render($this->getDefaultTemplate(), $response);

                return $this->response->setContent($content);

            // Response directly
            case is_scalar($response) || is_null($response) :
                return $this->response->setContent($response);

            // Response if not sent
            case $response instanceof Response :
                return $response;

            default :
                throw new \InvalidArgumentException(sprintf(
                    'Expected argument of type array, printable variable or \Wei\Response, "%s" given',
                    is_object($response) ? get_class($response) : gettype($response)
                ));
        }
    }
public function handleResponse($response)
    {
        switch (true) {
            // Render default template and use $response as template variables
            case is_array($response) :
                $content = $this->view->render($this->getDefaultTemplate(), $response);

                return $this->response->setContent($content);

            // Response directly
            case is_scalar($response) || is_null($response) :
                return $this->response->setContent($response);

            // Response if not sent
            case $response instanceof Response :
                return $response;

            default :
                throw new \InvalidArgumentException(sprintf(
                    'Expected argument of type array, printable variable or \Wei\Response, "%s" given',
                    is_object($response) ? get_class($response) : gettype($response)
                ));
        }
    }
public function handleResponse ( $ response ) { switch ( true ) { // Render default template and use $response as template variables case is_array ( $ response ) : $ content = $ this -> view -> render ( $ this -> getDefaultTemplate ( ) , $ response ) ; return $ this -> response -> setContent ( $ content ) ; // Response directly case is_scalar ( $ response ) || is_null ( $ response ) : return $ this -> response -> setContent ( $ response ) ; // Response if not sent case $ response instanceof Response : return $ response ; default : throw new \ InvalidArgumentException ( sprintf ( 'Expected argument of type array, printable variable or \Wei\Response, "%s" given' , is_object ( $ response ) ? get_class ( $ response ) : gettype ( $ response ) ) ) ; } }
Handle the response variable returned by controller action

@param  mixed $response
@return Response
@throws \InvalidArgumentException
Handle the response variable returned by controller action