Skip to content

Commit

Permalink
DIAM-1832 add check for non-existent header
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kolomiiets committed Feb 8, 2017
1 parent 4e690fe commit 7270c94
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Infrastructure/Message/Zend/ImapMessageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,24 @@ protected function isAutoresponder(Headers $headers)
foreach ($autoresponderHeaders as $header => $value) {
$headerEntity = $headers->get($header);

if ($headerEntity instanceof \ArrayIterator) {
foreach ($headerEntity->getArrayCopy() as $k => $nestedHeader) {
if (!$nestedHeader instanceof HeaderInterface) {
throw new MessageProcessingException('Expected type header ArrayIterator or HeaderInterface');
if ($headerEntity) {
if ($headerEntity instanceof \ArrayIterator) {
foreach ($headerEntity->getArrayCopy() as $k => $nestedHeader) {
if (!$nestedHeader instanceof HeaderInterface) {
throw new MessageProcessingException('Expected type header HeaderInterface');
}

if ($this->checkAutoresponder($nestedHeader, $value)) {
return true;
}
}

if ($this->checkAutoresponder($nestedHeader, $value)) {
} elseif ($headerEntity instanceof HeaderInterface) {
if ($this->checkAutoresponder($headerEntity, $value)) {
return true;
}
} else {
throw new MessageProcessingException('Expected type header ArrayIterator or HeaderInterface');
}
} elseif ($headerEntity instanceof HeaderInterface) {
if ($this->checkAutoresponder($headerEntity, $value)) {
return true;
}
} else {
throw new MessageProcessingException('Expected type header ArrayIterator or HeaderInterface');
}
}

Expand Down

0 comments on commit 7270c94

Please sign in to comment.