aboutsummaryrefslogtreecommitdiffstats
path: root/Mime.php
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2014-05-21 11:01:18 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2014-05-21 11:01:18 +0200
commit272c1604d11ebbc0dada39227f0fe6e3d553d42b (patch)
treeb5a6bbce84cb32d3512c6be79dede2ed4476c129 /Mime.php
parent7afac85d56973c3851e10761ba278b1805aab565 (diff)
downloadMime-272c1604d11ebbc0dada39227f0fe6e3d553d42b.zip
Mime-272c1604d11ebbc0dada39227f0fe6e3d553d42b.tar.gz
Mime-272c1604d11ebbc0dada39227f0fe6e3d553d42b.tar.bz2
Throw an exception if an extension is unknown…
… while finding with the `_find` method.
Diffstat (limited to 'Mime.php')
-rw-r--r--Mime.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/Mime.php b/Mime.php
index f239f76..890bb90 100644
--- a/Mime.php
+++ b/Mime.php
@@ -384,6 +384,12 @@ class Mime implements \Hoa\Core\Parameter\Parameterizable {
$this->_extension = substr($based, $poos + 1);
$this->_mime = static::getMimeFromExtension($this->_extension);
+
+ if(null === $this->_mime)
+ throw new Exception\MimeIsNotFound(
+ 'No MIME type associated to the %s extension.',
+ 5, $this->_extension);
+
list($this->_media, $this->_type) = static::parseMime($this->_mime);
return;