yii\web\Response::defaultFormatters PHP Method

defaultFormatters() protected method

protected defaultFormatters ( ) : array
return array the formatters that are supported by default
    protected function defaultFormatters()
    {
        return [self::FORMAT_HTML => 'yii\\web\\HtmlResponseFormatter', self::FORMAT_XML => 'yii\\web\\XmlResponseFormatter', self::FORMAT_JSON => 'yii\\web\\JsonResponseFormatter', self::FORMAT_JSONP => ['class' => 'yii\\web\\JsonResponseFormatter', 'useJsonp' => true]];
    }

Usage Example

Example #1
0
 /**
  * Adds the Thrift formatter to the default formatters.
  * @return array the formatters that are supported by default
  */
 protected function defaultFormatters()
 {
     return array_merge(parent::defaultFormatters(), ['thrift' => 'RangelReale\\nithrift\\ResponseFormatter']);
 }