public function setResponseBody($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data, \JSON_PRETTY_PRINT);
        }
        $this->response->getBody()->write($data);
        return $this;
    }
public function setResponseBody($data)
    {
        if (!is_string($data)) {
            $data = json_encode($data, \JSON_PRETTY_PRINT);
        }
        $this->response->getBody()->write($data);
        return $this;
    }
public function setResponseBody ( $ data ) { if ( ! is_string ( $ data ) ) { $ data = json_encode ( $ data , \ JSON_PRETTY_PRINT ) ; } $ this -> response -> getBody ( ) -> write ( $ data ) ; return $ this ; }
Set response body if is not string json_encode

@param mixed $data
@return $this
Set response body if is not string json_encode