123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
-
-
-
-
-
- class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
- {
-
-
-
- private $_address;
-
-
-
- public function __construct($name, Swift_Mime_Grammar $grammar)
- {
- $this->setFieldName($name);
- parent::__construct($grammar);
- }
-
-
-
- public function getFieldType()
- {
- return self::TYPE_PATH;
- }
-
-
-
- public function setFieldBodyModel($model)
- {
- $this->setAddress($model);
- }
-
-
-
- public function getFieldBodyModel()
- {
- return $this->getAddress();
- }
-
-
-
- public function setAddress($address)
- {
- if (is_null($address))
- {
- $this->_address = null;
- }
- elseif ('' == $address)
- {
- $this->_address = '';
- }
- else
- {
- $this->_assertValidAddress($address);
- $this->_address = $address;
- }
- $this->setCachedValue(null);
- }
-
-
-
- public function getAddress()
- {
- return $this->_address;
- }
-
-
-
- public function getFieldBody()
- {
- if (!$this->getCachedValue())
- {
- if (isset($this->_address))
- {
- $this->setCachedValue('<' . $this->_address . '>');
- }
- }
- return $this->getCachedValue();
- }
-
-
-
- private function _assertValidAddress($address)
- {
- if (!preg_match('/^' . $this->getGrammar()->getDefinition('addr-spec') . '$/D',
- $address))
- {
- throw new Swift_RfcComplianceException(
- 'Address set in PathHeader does not comply with addr-spec of RFC 2822.'
- );
- }
- }
-
- }
|