Skip to content

Commit

Permalink
Support unknown part types (ref #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Jan 24, 2015
1 parent 6283995 commit 20aea76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Message/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Part implements \RecursiveIterator
const TYPE_IMAGE = 'image';
const TYPE_VIDEO = 'video';
const TYPE_OTHER = 'other';
const TYPE_UNKNOWN = 'unknown';

const ENCODING_7BIT = '7bit';
const ENCODING_8BIT = '8bit';
Expand Down Expand Up @@ -211,7 +212,12 @@ protected function fetchStructure($partNumber = null)

protected function parseStructure(\stdClass $structure)
{
$this->type = $this->typesMap[$structure->type];
if (isset($this->typesMap[$structure->type])) {
$this->type = $this->typesMap[$structure->type];
} else {
$this->type = self::TYPE_UNKNOWN;
}

$this->encoding = $this->encodingsMap[$structure->encoding];
$this->subtype = $structure->subtype;

Expand Down

0 comments on commit 20aea76

Please sign in to comment.