consumerService->getSubReceivedConsumer('from'), $this->consumerService->getSubReceivedConsumer('by'), $this->consumerService->getSubReceivedConsumer('via'), $this->consumerService->getSubReceivedConsumer('with'), $this->consumerService->getSubReceivedConsumer('id'), $this->consumerService->getSubReceivedConsumer('for'), $this->consumerService->getSubReceivedConsumer('date'), $this->consumerService->getCommentConsumer(), ]; } /** * Overridden to exclude the MimeLiteralPart pattern that comes by default * in AbstractConsumer. * * @return string the regex pattern */ protected function getTokenSplitPattern(): string { $sChars = \implode('|', $this->getAllTokenSeparators()); return '~('.$sChars.')~'; } /** * Overridden to /not/ advance when the end token matches a start token for * a sub-consumer. * * @return static */ protected function advanceToNextToken(Iterator $tokens, bool $isStartToken) { if ($isStartToken) { $tokens->next(); } elseif ($tokens->valid() && !$this->isEndToken($tokens->current())) { foreach ($this->getSubConsumers() as $consumer) { if ($consumer->isStartToken($tokens->current())) { return $this; } } $tokens->next(); } return $this; } /** * Overridden to combine all part values into a single string and return it * as an array with a single element. * * @param \ZBateson\MailMimeParser\Header\IHeaderPart[] $parts * * @return \ZBateson\MailMimeParser\Header\IHeaderPart[] */ protected function processParts(array $parts): array { $ret = []; foreach ($parts as $part) { if ($part instanceof Token) { continue; } $ret[] = $part; } return $ret; } }