Dingo\Api\Http\Response::getFormatter PHP Method

getFormatter() public static method

Get the formatter based on the requested format type.
public static getFormatter ( string $format ) : Dingo\Api\Http\Response\Format\Format
$format string
return Dingo\Api\Http\Response\Format\Format
    public static function getFormatter($format)
    {
        if (!static::hasFormatter($format)) {
            throw new NotAcceptableHttpException('Unable to format response according to Accept header.');
        }
        return static::$formatters[$format];
    }

Usage Example

 /**
  * @expectedException \RuntimeException
  */
 public function testGettingUnregisteredFormatterThrowsException()
 {
     Response::getFormatter('test');
 }
All Usage Examples Of Dingo\Api\Http\Response::getFormatter