(Yaf >=3.2.2)
Yaf_Dispatcher::setResponse — Set the response object
Set the response object used by the dispatcher. This allows using a custom response implementation instead of the built-in ones.
responseA Yaf_Response_Abstract instance.
Returns the Yaf_Dispatcher object itself on
success, or null if the application is not initialized.
Ejemplo #1 Yaf_Dispatcher::setResponse() example
<?php
class ApiResponse extends Yaf_Response_Http
{
public function response()
{
header("Content-Type: application/json");
parent::response();
}
}
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");
Yaf_Dispatcher::getInstance()->setResponse(new ApiResponse());
$app->run();
?>