Jyxo\Mail\Parser::parseBody PHP Méthode

parseBody() public méthode

Parses message body.
public parseBody ( string $pid = null, string $mimeType = 'text/html', boolean $alternative = true, boolean $all = false )
$pid string Part Id
$mimeType string Default mime-type
$alternative boolean Should the alternative part be used as well
$all boolean Should all parts get parsed
    public function parseBody(string $pid = null, string $mimeType = 'text/html', bool $alternative = true, bool $all = false)
    {
        try {
            $this->checkIfParsed();
        } catch (\Jyxo\Mail\Parser\EmailNotExistException $e) {
            throw $e;
        }
        if (null === $pid) {
            $pid = $this->defaultPid;
        }
        // If only one part exists, it is already parsed
        if (count($this->structure['pid']) > 1) {
            $key = array_search($pid, $this->structure['pid']);
            if (false !== $key) {
                if ($all) {
                    $this->parseMultiparts($pid, $mimeType, 'all', 2, $alternative);
                } else {
                    if ($pid == $this->defaultPid) {
                        $this->parseMultiparts($pid, $mimeType, 'top', 2, $alternative);
                    } elseif ('message/rfc822' == $this->structure['ftype'][1]) {
                        $this->parseMultiparts($pid, $mimeType, 'subparts', 1, $alternative);
                    }
                }
            }
        }
    }