diff --git a/src/Decode.php b/src/Decode.php index bc8527a..1b444a0 100644 --- a/src/Decode.php +++ b/src/Decode.php @@ -23,7 +23,6 @@ * @namespace */ namespace Zend\Mime; -use Zend; /** * @uses \Zend\Exception @@ -72,7 +71,7 @@ public static function splitMime($body, $boundary) // no more parts, find end boundary $p = strpos($body, '--' . $boundary . '--', $start); if ($p===false) { - throw new Zend\Exception('Not a valid Mime Message: End Missing'); + throw new Exception\RuntimeException('Not a valid Mime Message: End Missing'); } // the remaining part also needs to be parsed: @@ -205,7 +204,7 @@ public static function splitHeaderField($field, $wantedPart = null, $firstName = $field = $firstName . '=' . $field; if (!preg_match_all('%([^=\s]+)\s*=\s*("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) { - throw new Zend\Exception('not a valid header field'); + throw new Exception\RuntimeException('not a valid header field'); } if ($wantedPart) { diff --git a/src/Exception.php b/src/Exception.php index 8489413..eed63b2 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -23,7 +23,6 @@ * @namespace */ namespace Zend\Mime; -use Zend; /** * @uses \Zend\Exception @@ -32,6 +31,6 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Exception extends Zend\Exception +interface Exception {} diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php new file mode 100644 index 0000000..15e160f --- /dev/null +++ b/src/Exception/RuntimeException.php @@ -0,0 +1,41 @@ +language = $value; break; default: - throw new Zend\Exception('Unknown header ignored for MimePart:' . $key); + throw new Exception\RuntimeException('Unknown header ignored for MimePart:' . $key); } } $res->addPart($newPart); diff --git a/src/Part.php b/src/Part.php index d00abf7..9445001 100644 --- a/src/Part.php +++ b/src/Part.php @@ -94,7 +94,7 @@ public function isStream() public function getEncodedStream() { if (!$this->_isStream) { - throw new Exception('Attempt to get a stream from a string part'); + throw new Exception\RuntimeException('Attempt to get a stream from a string part'); } //stream_filter_remove(); // ??? is that right? @@ -110,7 +110,7 @@ public function getEncodedStream() ) ); if (!is_resource($filter)) { - throw new Exception('Failed to append quoted-printable filter'); + throw new Exception\RuntimeException('Failed to append quoted-printable filter'); } break; case Mime::ENCODING_BASE64: @@ -124,7 +124,7 @@ public function getEncodedStream() ) ); if (!is_resource($filter)) { - throw new Exception('Failed to append base64 filter'); + throw new Exception\RuntimeException('Failed to append base64 filter'); } break; default: diff --git a/test/MessageTest.php b/test/MessageTest.php index ca23f5e..64918cb 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -26,10 +26,6 @@ namespace ZendTest\Mime; use Zend\Mime; -/** - * PHPUnit test case - */ - /** * @category Zend * @package Zend_Mime diff --git a/test/PartTest.php b/test/PartTest.php index 5ea3c81..4fcb0e6 100644 --- a/test/PartTest.php +++ b/test/PartTest.php @@ -26,14 +26,6 @@ namespace ZendTest\Mime; use Zend\Mime; -/** - * Zend_Mime_Part - */ - -/** - * PHPUnit test case - */ - /** * @category Zend * @package Zend_Mime