1 | <?php |
||
21 | class PartStreamRegistry |
||
22 | { |
||
23 | /** |
||
24 | * @var array Array of handles, with message IDs as keys. |
||
25 | */ |
||
26 | private $registeredHandles; |
||
27 | |||
28 | /** |
||
29 | * @var array Array of PartStream handles with message IDs as keys. |
||
30 | */ |
||
31 | private $registeredPartStreamHandles; |
||
32 | |||
33 | /** |
||
34 | * Registers an ID for the passed resource handle. |
||
35 | * |
||
36 | * @param string $id |
||
37 | * @param resource $handle |
||
38 | */ |
||
39 | public function register($id, $handle) |
||
40 | { |
||
41 | if (!isset($this->registeredHandles[$id])) { |
||
42 | $this->registeredHandles[$id] = $handle; |
||
43 | } |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Unregisters the given message ID. |
||
48 | * |
||
49 | * @param string $id |
||
50 | */ |
||
51 | public function unregister($id) |
||
55 | |||
56 | /** |
||
57 | * Returns the resource handle with the passed $id. |
||
58 | * |
||
59 | * @param string $id |
||
60 | * @return resource |
||
61 | */ |
||
62 | public function get($id) |
||
69 | |||
70 | /** |
||
71 | * Attaches a stream filter on the passed resource $handle for the part's |
||
72 | * encoding. |
||
73 | * |
||
74 | * @param \ZBateson\MailMimeParser\MimePart $part |
||
75 | * @param resource $handle |
||
76 | */ |
||
77 | private function attachEncodingFilterToStream(MimePart $part, $handle) |
||
94 | |||
95 | /** |
||
96 | * Attaches a mailmimeparser-encode stream filter based on the part's |
||
97 | * defined charset. |
||
98 | * |
||
99 | * @param \ZBateson\MailMimeParser\MimePart $part |
||
100 | * @param resource $handle |
||
101 | */ |
||
102 | private function attachCharsetFilterToStream(MimePart $part, $handle) |
||
112 | |||
113 | /** |
||
114 | * Creates a part stream handle for the start and end position of the |
||
115 | * message stream, and attaches it to the passed MimePart. |
||
116 | * |
||
117 | * @param MimePart $part |
||
118 | * @param Message $message |
||
119 | * @param int $start |
||
120 | * @param int $end |
||
121 | */ |
||
122 | public function attachPartStreamHandle(MimePart $part, Message $message, $start, $end) |
||
136 | } |
||
137 |