From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- .../Swift/Mime/Headers/IdentificationHeader.php | 161 +++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100755 External/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php (limited to 'External/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php') diff --git a/External/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php b/External/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php new file mode 100755 index 0000000..55ff737 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php @@ -0,0 +1,161 @@ +setFieldName($name); + $this->initializeGrammar(); + } + + /** + * Get the type of Header that this instance represents. + * @return int + * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX + * @see TYPE_DATE, TYPE_ID, TYPE_PATH + */ + public function getFieldType() + { + return self::TYPE_ID; + } + + /** + * Set the model for the field body. + * This method takes a string ID, or an array of IDs + * @param mixed $model + * @throws Swift_RfcComplianceException + */ + public function setFieldBodyModel($model) + { + $this->setId($model); + } + + /** + * Get the model for the field body. + * This method returns an array of IDs + * @return array + */ + public function getFieldBodyModel() + { + return $this->getIds(); + } + + /** + * Set the ID used in the value of this header. + * @param string $id + * @throws Swift_RfcComplianceException + */ + public function setId($id) + { + return $this->setIds(array($id)); + } + + /** + * Get the ID used in the value of this Header. + * If multiple IDs are set only the first is returned. + * @return string + */ + public function getId() + { + if (count($this->_ids) > 0) + { + return $this->_ids[0]; + } + } + + /** + * Set a collection of IDs to use in the value of this Header. + * @param string[] $ids + * @throws Swift_RfcComplianceException + */ + public function setIds(array $ids) + { + $actualIds = array(); + + foreach ($ids as $k => $id) + { + if (preg_match( + '/^' . $this->getGrammar('id-left') . '@' . + $this->getGrammar('id-right') . '$/D', + $id + )) + { + $actualIds[] = $id; + } + else + { + throw new Swift_RfcComplianceException( + 'Invalid ID given <' . $id . '>' + ); + } + } + + $this->clearCachedValueIf($this->_ids != $actualIds); + $this->_ids = $actualIds; + } + + /** + * Get the list of IDs used in this Header. + * @return string[] + */ + public function getIds() + { + return $this->_ids; + } + + /** + * Get the string value of the body in this Header. + * This is not necessarily RFC 2822 compliant since folding white space will + * not be added at this stage (see {@link toString()} for that). + * @return string + * @see toString() + * @throws Swift_RfcComplianceException + */ + public function getFieldBody() + { + if (!$this->getCachedValue()) + { + $angleAddrs = array(); + + foreach ($this->_ids as $id) + { + $angleAddrs[] = '<' . $id . '>'; + } + + $this->setCachedValue(implode(' ', $angleAddrs)); + } + return $this->getCachedValue(); + } + +} -- cgit v1.2.3