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
 /**
  * @expectedException \RuntimeException
  */
 public function testGettingUnregisteredFormatterThrowsException()
 {
     Response::getFormatter('test');
 }
Example #2
0
 /**
  * @expectedException \Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException
  * @expectedExceptionMessage Unable to format response according to Accept header.
  */
 public function testGettingInvalidFormatterThrowsException()
 {
     Response::getFormatter('json');
 }