|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the ZBateson\MailMimeParser project. |
|
4
|
|
|
* |
|
5
|
|
|
* @license http://opensource.org/licenses/bsd-license.php BSD |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace ZBateson\MailMimeParser\Parser\Proxy; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* A bi-directional parser-to-part proxy for NonMimeParser and IUUEncodedParts. |
|
12
|
|
|
* |
|
13
|
|
|
* @author Zaahid Bateson |
|
14
|
|
|
*/ |
|
15
|
|
|
class ParserUUEncodedPartProxy extends ParserPartProxy |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* Only has a single parent of type ParserNonMimeMessageProxy, overridden to |
|
19
|
|
|
* specify ParserNonMimeMessageProxy as the return type. |
|
20
|
|
|
*/ |
|
21
|
9 |
|
public function getParent() : ParserNonMimeMessageProxy |
|
22
|
|
|
{ |
|
23
|
9 |
|
return parent::getParent(); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Returns the next part's start position within the message's raw stream, |
|
28
|
|
|
* or null if not set, not discovered, or there are no more parts under this |
|
29
|
|
|
* message. |
|
30
|
|
|
* |
|
31
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
32
|
|
|
* getNextPartStart() on its parent (a ParserNonMimeMessageProxy, which |
|
33
|
|
|
* stores/returns this information). |
|
34
|
|
|
* |
|
35
|
|
|
* @return int|null The start position or null |
|
36
|
|
|
*/ |
|
37
|
4 |
|
public function getNextPartStart() : ?int |
|
38
|
|
|
{ |
|
39
|
4 |
|
return $this->getParent()->getNextPartStart(); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Returns the next part's unix file mode in a uu-encoded 'begin' line if |
|
44
|
|
|
* one exists, or null otherwise. |
|
45
|
|
|
* |
|
46
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
47
|
|
|
* getNextPartMode() on its parent (a ParserNonMimeMessageProxy, which |
|
48
|
|
|
* stores/returns this information). |
|
49
|
|
|
* |
|
50
|
|
|
* @return int|null The file mode or null |
|
51
|
|
|
*/ |
|
52
|
1 |
|
public function getNextPartMode() : ?int |
|
53
|
|
|
{ |
|
54
|
1 |
|
return $this->getParent()->getNextPartMode(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Returns the next part's filename in a uu-encoded 'begin' line if one |
|
59
|
|
|
* exists, or null otherwise. |
|
60
|
|
|
* |
|
61
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
62
|
|
|
* getNextPartFilename() on its parent (a ParserNonMimeMessageProxy, which |
|
63
|
|
|
* stores/returns this information). |
|
64
|
|
|
* |
|
65
|
|
|
* @return ?string The file name or null |
|
66
|
|
|
*/ |
|
67
|
1 |
|
public function getNextPartFilename() : ?string |
|
68
|
|
|
{ |
|
69
|
1 |
|
return $this->getParent()->getNextPartFilename(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Sets the next part's start position within the message's raw stream. |
|
74
|
|
|
* |
|
75
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
76
|
|
|
* setNextPartStart() on its parent (a ParserNonMimeMessageProxy, which |
|
77
|
|
|
* stores/returns this information). |
|
78
|
|
|
*/ |
|
79
|
4 |
|
public function setNextPartStart(int $nextPartStart) : static |
|
80
|
|
|
{ |
|
81
|
4 |
|
$this->getParent()->setNextPartStart($nextPartStart); |
|
82
|
4 |
|
return $this; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Sets the next part's unix file mode from its 'begin' line. |
|
87
|
|
|
* |
|
88
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
89
|
|
|
* setNextPartMode() on its parent (a ParserNonMimeMessageProxy, which |
|
90
|
|
|
* stores/returns this information). |
|
91
|
|
|
*/ |
|
92
|
4 |
|
public function setNextPartMode(int $nextPartMode) : static |
|
93
|
|
|
{ |
|
94
|
4 |
|
$this->getParent()->setNextPartMode($nextPartMode); |
|
95
|
4 |
|
return $this; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Sets the next part's filename from its 'begin' line. |
|
100
|
|
|
* |
|
101
|
|
|
* As this is a message-wide setting, ParserUUEncodedPartProxy calls |
|
102
|
|
|
* setNextPartFilename() on its parent (a ParserNonMimeMessageProxy, which |
|
103
|
|
|
* stores/returns this information). |
|
104
|
|
|
*/ |
|
105
|
4 |
|
public function setNextPartFilename(string $nextPartFilename) : static |
|
106
|
|
|
{ |
|
107
|
4 |
|
$this->getParent()->setNextPartFilename($nextPartFilename); |
|
108
|
4 |
|
return $this; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Returns the file mode included in the uuencoded 'begin' line for this |
|
113
|
|
|
* part. |
|
114
|
|
|
*/ |
|
115
|
4 |
|
public function getUnixFileMode() : ?int |
|
116
|
|
|
{ |
|
117
|
4 |
|
return $this->getHeaderContainer()->getUnixFileMode(); |
|
|
|
|
|
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Returns the filename included in the uuencoded 'begin' line for this |
|
122
|
|
|
* part. |
|
123
|
|
|
*/ |
|
124
|
4 |
|
public function getFilename() : ?string |
|
125
|
|
|
{ |
|
126
|
4 |
|
return $this->getHeaderContainer()->getFilename(); |
|
|
|
|
|
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|