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 | * Creates a part stream handle for the start and end position of the |
||
72 | * message stream, and attaches it to the passed MimePart. |
||
73 | * |
||
74 | * @param MimePart $part |
||
75 | * @param Message $message |
||
76 | * @param int $start |
||
77 | * @param int $end |
||
78 | */ |
||
79 | public function attachPartStreamHandle(MimePart $part, Message $message, $start, $end) |
||
108 | } |
||
109 |