1 | <?php |
||
25 | class SimpleDi |
||
|
|||
26 | { |
||
27 | /** |
||
28 | * @var \ZBateson\MailMimeParser\MimePartFactory singleton 'service' instance |
||
29 | */ |
||
30 | protected $partFactory; |
||
31 | |||
32 | /** |
||
33 | * @var \ZBateson\MailMimeParser\Stream\PartStreamRegistry singleton |
||
34 | * 'service' instance |
||
35 | */ |
||
36 | protected $partStreamRegistry; |
||
37 | |||
38 | /** |
||
39 | * @var \ZBateson\MailMimeParser\Header\HeaderFactory singleton 'service' |
||
40 | * instance |
||
41 | */ |
||
42 | protected $headerFactory; |
||
43 | |||
44 | /** |
||
45 | * @var \ZBateson\MailMimeParser\Header\Part\HeaderPartFactory singleton |
||
46 | * 'service' instance |
||
47 | */ |
||
48 | protected $headerPartFactory; |
||
49 | |||
50 | /** |
||
51 | * @var \ZBateson\MailMimeParser\Header\Part\MimeLiteralPartFactory |
||
52 | * singleton 'service' instance |
||
53 | */ |
||
54 | protected $mimeLiteralPartFactory; |
||
55 | |||
56 | /** |
||
57 | * @var \ZBateson\MailMimeParser\Header\Consumer\ConsumerService singleton |
||
58 | * 'service' instance |
||
59 | */ |
||
60 | protected $consumerService; |
||
61 | |||
62 | /** |
||
63 | * Constructs a SimpleDi - call singleton() to invoke |
||
64 | */ |
||
65 | 1 | private function __construct() |
|
68 | |||
69 | /** |
||
70 | * Returns the singleton instance. |
||
71 | * |
||
72 | * @return \ZBateson\MailMimeParser\SimpleDi |
||
73 | */ |
||
74 | 9 | public static function singleton() |
|
82 | |||
83 | /** |
||
84 | * Returns a singleton 'service' instance for the given service named $var |
||
85 | * with a class type of $class. |
||
86 | * |
||
87 | * @param string $var the name of the service |
||
88 | * @param string $class the name of the class |
||
89 | * @return mixed the service object |
||
90 | */ |
||
91 | 4 | protected function getInstance($var, $class) |
|
98 | |||
99 | /** |
||
100 | * Constructs and returns a new MessageParser object. |
||
101 | * |
||
102 | * @return \ZBateson\MailMimeParser\MessageParser |
||
103 | */ |
||
104 | 1 | public function newMessageParser() |
|
112 | |||
113 | /** |
||
114 | * Constructs and returns a new Message object. |
||
115 | * |
||
116 | * @return \ZBateson\MailMimeParser\Message |
||
117 | */ |
||
118 | 2 | public function newMessage() |
|
124 | |||
125 | /** |
||
126 | * Returns the part factory service instance. |
||
127 | * |
||
128 | * @return \ZBateson\MailMimeParser\MimePartFactory |
||
129 | */ |
||
130 | 2 | public function getPartFactory() |
|
139 | |||
140 | /** |
||
141 | * Returns the header factory service instance. |
||
142 | * |
||
143 | * @return \ZBateson\MailMimeParser\Header\HeaderFactory |
||
144 | */ |
||
145 | 3 | public function getHeaderFactory() |
|
152 | |||
153 | /** |
||
154 | * Returns the part stream registry service instance. The method also |
||
155 | * registers the stream extension by calling registerStreamExtensions. |
||
156 | * |
||
157 | * @return \ZBateson\MailMimeParser\Stream\PartStreamRegistry |
||
158 | */ |
||
159 | 2 | public function getPartStreamRegistry() |
|
166 | |||
167 | /** |
||
168 | * Returns the part factory service |
||
169 | * |
||
170 | * @return \ZBateson\MailMimeParser\Header\Part\HeaderPartFactory |
||
171 | */ |
||
172 | 2 | public function getHeaderPartFactory() |
|
176 | |||
177 | /** |
||
178 | * Returns the MimeLiteralPartFactory service |
||
179 | * |
||
180 | * @return \ZBateson\MailMimeParser\Header\Part\MimeLiteralPartFactory |
||
181 | */ |
||
182 | 2 | public function getMimeLiteralPartFactory() |
|
186 | |||
187 | /** |
||
188 | * Returns the header consumer service |
||
189 | * |
||
190 | * @return \ZBateson\MailMimeParser\Header\Consumer\ConsumerService |
||
191 | */ |
||
192 | 2 | public function getConsumerService() |
|
202 | |||
203 | /** |
||
204 | * Registers stream extensions for PartStream and CharsetStreamFilter |
||
205 | * |
||
206 | * @see stream_filter_register |
||
207 | * @see stream_wrapper_register |
||
208 | */ |
||
209 | 1 | protected function registerStreamExtensions() |
|
231 | } |
||
232 |