コード例 #1
0
ファイル: Part.php プロジェクト: shapecode/imap
 protected function parseStructure(\stdClass $structure)
 {
     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;
     if (isset($structure->bytes)) {
         $this->bytes = $structure->bytes;
     }
     foreach (array('disposition', 'bytes', 'description') as $optional) {
         if (isset($structure->{$optional})) {
             $this->{$optional} = $structure->{$optional};
         }
     }
     $this->parameters = new Parameters();
     if (is_array($structure->parameters)) {
         $this->parameters->add($structure->parameters);
     }
     if (isset($structure->dparameters)) {
         $this->parameters->add($structure->dparameters);
     }
     if (isset($structure->parts)) {
         foreach ($structure->parts as $key => $partStructure) {
             if (null === $this->partNumber) {
                 $partNumber = $key + 1;
             } else {
                 $partNumber = (string) ($this->partNumber . '.' . ($key + 1));
             }
             if ($this->isAttachment($partStructure)) {
                 $this->parts[] = new Attachment($this->stream, $this->messageNumber, $partNumber, $partStructure);
             } else {
                 $this->parts[] = new Part($this->stream, $this->messageNumber, $partNumber, $partStructure);
             }
         }
     }
 }
コード例 #2
0
ファイル: Headers.php プロジェクト: shapecode/imap
 /**
  * Get header
  *
  * @param string $key
  *
  * @return string
  */
 public function get($key)
 {
     return parent::get(strtolower($key));
 }