Request::getFormat PHP Method

getFormat() public static method

Gets the format associated with the mime type.
public static getFormat ( string $mimeType ) : string | null
$mimeType string The associated mime type
return string | null The format (null if not found)
        public static function getFormat($mimeType)
        {
            //Method inherited from \Symfony\Component\HttpFoundation\Request
            return \Illuminate\Http\Request::getFormat($mimeType);
        }

Usage Example

Example #1
0
 public function getOutput($connections)
 {
     if (parent::getFormat() == "xml") {
         return new XMLConnectionOutput($connections);
     } else {
         if (parent::getFormat() == "json") {
             return new JSONConnectionOutput($connections);
         } else {
             throw new Exception("No outputformat specified");
         }
     }
 }
All Usage Examples Of Request::getFormat