1 | <?php |
||
14 | class Swift_MongoDbSpool extends Swift_ConfigurableSpool |
||
15 | { |
||
16 | /** |
||
17 | * @var \MongoDB\Driver\Manager |
||
18 | */ |
||
19 | private $manager; |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $collection; |
||
24 | /** |
||
25 | * @var \MongoDB\Driver\ReadPreference |
||
26 | */ |
||
27 | private $rp; |
||
28 | /** |
||
29 | * @var MongoDB\Driver\WriteConcern |
||
30 | */ |
||
31 | private $wc; |
||
32 | |||
33 | private static $limit1 = array('limit' => 1); |
||
34 | |||
35 | /** |
||
36 | * Creates a new MongoDB spool. |
||
37 | * |
||
38 | * @param \MongoDB\Driver\Manager $manager The manager |
||
39 | * @param string $collection The collection name (e.g. "mydb.emails") |
||
40 | * @param \MongoDB\Driver\ReadPreference $rp Optional read preference |
||
41 | * @param \MongoDB\Driver\WriteConcern $wc Optional write concern |
||
42 | */ |
||
43 | 2 | public function __construct(\MongoDB\Driver\Manager $manager, $collection, \MongoDB\Driver\ReadPreference $rp = null, \MongoDB\Driver\WriteConcern $wc = null) |
|
50 | |||
51 | 1 | private function checkBlank($value) |
|
59 | |||
60 | /** |
||
61 | * Tests if this Spool mechanism has started. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 1 | public function isStarted() |
|
69 | |||
70 | /** |
||
71 | * Starts this Spool mechanism. |
||
72 | */ |
||
73 | public function start() |
||
74 | { |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Stops this Spool mechanism. |
||
79 | */ |
||
80 | public function stop() |
||
81 | { |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Queues a message. |
||
86 | * |
||
87 | * @param Swift_Mime_SimpleMessage $message The message to store |
||
88 | * @throws Swift_IoException |
||
89 | * @return bool |
||
90 | */ |
||
91 | 1 | public function queueMessage(Swift_Mime_SimpleMessage $message) |
|
100 | |||
101 | /** |
||
102 | * Execute a recovery if for any reason a process is sending for too long. |
||
103 | * |
||
104 | * @param int $timeout in second Defaults is for very slow smtp responses |
||
105 | * @throws Swift_IoException |
||
106 | */ |
||
107 | 1 | public function recover($timeout = 900) |
|
117 | |||
118 | /** |
||
119 | * Sends messages using the given transport instance. |
||
120 | * |
||
121 | * @param Swift_Transport $transport A transport instance |
||
122 | * @param string[] $failedRecipients An array of failures by-reference |
||
123 | * @throws Swift_IoException |
||
124 | * @return int The number of sent e-mails |
||
125 | */ |
||
126 | 1 | public function flushQueue(Swift_Transport $transport, &$failedRecipients = null) |
|
151 | |||
152 | /** |
||
153 | * Performs a query. |
||
154 | * |
||
155 | * @param array $query The query to perform |
||
156 | * @param array $options Optional array of query options |
||
157 | * @return \MongoDB\Driver\Cursor The results cursor |
||
158 | * @throws Swift_IoException |
||
159 | */ |
||
160 | 1 | protected function find(array $query, array $options = array()) |
|
169 | |||
170 | /** |
||
171 | * Deletes a single record. |
||
172 | * |
||
173 | * @param \MongoDB\BSON\ObjectID $id The ID of the message to delete |
||
174 | * @throws Swift_IoException |
||
175 | */ |
||
176 | 1 | protected function delete(\MongoDB\BSON\ObjectID $id) |
|
182 | |||
183 | /** |
||
184 | * Sets a single record's sentOn field. |
||
185 | * |
||
186 | * @param \MongoDB\BSON\ObjectID $id The ID of the message to update |
||
187 | * @param \MongoDB\BSON\UTCDateTime $time The time (or null) to set |
||
188 | * @return \MongoDB\Driver\WriteResult the write result |
||
189 | * @throws Swift_IoException |
||
190 | */ |
||
191 | 1 | protected function setSentOn(\MongoDB\BSON\ObjectID $id, \MongoDB\BSON\UTCDateTime $time = null) |
|
197 | |||
198 | /** |
||
199 | * Executes a bulk write to MongoDB, wrapping exceptions. |
||
200 | * |
||
201 | * @param \MongoDB\Driver\BulkWrite $bulk |
||
202 | * @return \MongoDB\Driver\WriteResult the write result |
||
203 | * @throws Swift_IoException if things go wrong |
||
204 | */ |
||
205 | 3 | protected function write(\MongoDB\Driver\BulkWrite $bulk) |
|
213 | |||
214 | /** |
||
215 | * Gets the current date. |
||
216 | * |
||
217 | * @param int $offset Milliseconds offset |
||
218 | * @return \MongoDB\BSON\UTCDateTime the current date |
||
219 | */ |
||
220 | 1 | protected function now($offset = 0) |
|
224 | } |
||
225 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.