private function doParseBoundary($boundary) { $result = array(); $prefix = "--" . $boundary; $this->consumeRegexp("/\n*/"); $this->consumeTo($prefix); $this->consume($prefix); while ($this->expects("\n")) { $content = $this->consumeTo("\n" . $prefix); $part = new Part(); $part->loadSource($content); if ($part->isMultipart()) { $result += $part->getParts(); } else { $result[] = $part; } $this->consume("\n" . $prefix); } return $result; }