public static function create($format = self::FORMAT_JSON, $engine = self::ENGINE_API)
    {
        $response = '\Eureka\Component\Response';

        switch ($format) {
            //~ Json
            case self::FORMAT_JSON:
                $responseFormat = '\Json';
                break;
            //~ Html
            case self::FORMAT_HTML:
                $responseFormat = '\Html';
                break;
            //~ Other
            case self::FORMAT_XML:
            case self::FORMAT_TEXT:
            default:
                throw new \DomainException('Unsupported output format !');
        }

        switch ($engine) {
            //~ Api Engine
            case self::ENGINE_API:
                $response .= $responseFormat . '\Api';
                break;
            //~ Layout Engine
            case self::ENGINE_TEMPLATE:
                $response .= $responseFormat . '\Template';
                break;
            //~ None
            case self::ENGINE_NONE:
                $response .= $responseFormat . $responseFormat;
                //~ Do not add engine name to the class name.
                break;
            //~ Other
            default:
                throw new \DomainException('Unsupported output engine !');
        }

        $responseInstance = new $response();

        return $responseInstance;
    }
public static function create($format = self::FORMAT_JSON, $engine = self::ENGINE_API)
    {
        $response = '\Eureka\Component\Response';

        switch ($format) {
            //~ Json
            case self::FORMAT_JSON:
                $responseFormat = '\Json';
                break;
            //~ Html
            case self::FORMAT_HTML:
                $responseFormat = '\Html';
                break;
            //~ Other
            case self::FORMAT_XML:
            case self::FORMAT_TEXT:
            default:
                throw new \DomainException('Unsupported output format !');
        }

        switch ($engine) {
            //~ Api Engine
            case self::ENGINE_API:
                $response .= $responseFormat . '\Api';
                break;
            //~ Layout Engine
            case self::ENGINE_TEMPLATE:
                $response .= $responseFormat . '\Template';
                break;
            //~ None
            case self::ENGINE_NONE:
                $response .= $responseFormat . $responseFormat;
                //~ Do not add engine name to the class name.
                break;
            //~ Other
            default:
                throw new \DomainException('Unsupported output engine !');
        }

        $responseInstance = new $response();

        return $responseInstance;
    }
public static function create ( $ format = self :: FORMAT_JSON , $ engine = self :: ENGINE_API ) { $ response = '\Eureka\Component\Response' ; switch ( $ format ) { //~ Json case self :: FORMAT_JSON : $ responseFormat = '\Json' ; break ; //~ Html case self :: FORMAT_HTML : $ responseFormat = '\Html' ; break ; //~ Other case self :: FORMAT_XML : case self :: FORMAT_TEXT : default : throw new \ DomainException ( 'Unsupported output format !' ) ; } switch ( $ engine ) { //~ Api Engine case self :: ENGINE_API : $ response .= $ responseFormat . '\Api' ; break ; //~ Layout Engine case self :: ENGINE_TEMPLATE : $ response .= $ responseFormat . '\Template' ; break ; //~ None case self :: ENGINE_NONE : $ response .= $ responseFormat . $ responseFormat ; //~ Do not add engine name to the class name. break ; //~ Other default : throw new \ DomainException ( 'Unsupported output engine !' ) ; } $ responseInstance = new $ response ( ) ; return $ responseInstance ; }
Create response object.

@param  string $format
@param  string $engine
@return Response
@throws \DomainException
Create response object .