TYPO3
7.6
Users
bogdan
Projects
Kapeli
Resources
Dash
Docsets
TYPO3
src
vendor
swiftmailer
swiftmailer
lib
classes
Swift
Mime
Headers
PathHeader.php
Go to the documentation of this file.
1
<?php
2
3
/*
4
* This file is part of SwiftMailer.
5
* (c) 2004-2009 Chris Corbyn
6
*
7
* For the full copyright and license information, please view the LICENSE
8
* file that was distributed with this source code.
9
*/
10
16
class
Swift_Mime_Headers_PathHeader
extends
Swift_Mime_Headers_AbstractHeader
17
{
23
private
$_address
;
24
31
public
function
__construct
($name,
Swift_Mime_Grammar
$grammar)
32
{
33
$this->
setFieldName
($name);
34
parent::__construct($grammar);
35
}
36
45
public
function
getFieldType
()
46
{
47
return
self::TYPE_PATH;
48
}
49
58
public
function
setFieldBodyModel
($model)
59
{
60
$this->
setAddress
($model);
61
}
62
69
public
function
getFieldBodyModel
()
70
{
71
return
$this->
getAddress
();
72
}
73
81
public
function
setAddress
($address)
82
{
83
if
(is_null($address)) {
84
$this->_address = null;
85
}
elseif
(
''
== $address) {
86
$this->_address =
''
;
87
}
else
{
88
$this->
_assertValidAddress
($address);
89
$this->_address = $address;
90
}
91
$this->
setCachedValue
(null);
92
}
93
101
public
function
getAddress
()
102
{
103
return
$this->_address
;
104
}
105
116
public
function
getFieldBody
()
117
{
118
if
(!$this->
getCachedValue
()) {
119
if
(isset($this->_address)) {
120
$this->
setCachedValue
(
'<'
.$this->_address.
'>'
);
121
}
122
}
123
124
return
$this->
getCachedValue
();
125
}
126
134
private
function
_assertValidAddress
($address)
135
{
136
if
(!preg_match(
'/^'
.$this->
getGrammar
()->getDefinition(
'addr-spec'
).
'$/D'
,
137
$address)) {
138
throw
new
Swift_RfcComplianceException
(
139
'Address set in PathHeader does not comply with addr-spec of RFC 2822.'
140
);
141
}
142
}
143
}
Generated on Wed Nov 11 2015 01:52:01 for TYPO3 by
1.8.3