mimeRestricted() public static method

public static mimeRestricted ( $mime, $allowed_mimes )
 public function test_it_returns_a_415_for_restricted_type()
 {
     $e = (new SampleExceptionHandler())->render(FileNotSupportedException::mimeRestricted('text/foo', ['text/bar']));
     $this->assertHttpException($e, 415);
 }
Esempio n. 2
0
 /**
  * Ensure that the file's mime type is allowed.
  * @param  string $mime_type
  * @return string
  * @throws \Plank\Mediable\Exceptions\MediaUpload\FileNotSupportedException If the mime type is not allowed
  */
 private function verifyMimeType($mime_type)
 {
     $allowed = $this->config['allowed_mime_types'];
     if (!empty($allowed) && !in_array($mime_type, $allowed)) {
         throw FileNotSupportedException::mimeRestricted($mime_type, $allowed);
     }
     return $mime_type;
 }