@@ -111,17 +111,17 @@ class Folder {
111111 *
112112 * @param \Webklex\PHPIMAP\Client $client
113113 *
114- * @param object $folder
114+ * @param object structure
115115 */
116- public function __construct (Client $ client , $ folder ) {
116+ public function __construct (Client $ client , $ structure ) {
117117 $ this ->client = $ client ;
118118
119- $ this ->delimiter = $ folder ->delimiter ;
120- $ this ->path = $ folder ->name ;
121- $ this ->fullName = $ this ->decodeName ($ folder ->name );
119+ $ this ->setDelimiter ( $ structure ->delimiter ) ;
120+ $ this ->path = $ structure ->name ;
121+ $ this ->fullName = $ this ->decodeName ($ structure ->name );
122122 $ this ->name = $ this ->getSimpleName ($ this ->delimiter , $ this ->fullName );
123123
124- $ this ->parseAttributes ($ folder ->attributes );
124+ $ this ->parseAttributes ($ structure ->attributes );
125125 }
126126
127127 /**
@@ -187,6 +187,7 @@ public function setChildren($children = []) {
187187 * @param boolean $fetch_flags
188188 *
189189 * @return Message|null
190+ * @throws Exceptions\ConnectionFailedException
190191 */
191192 public function getMessage ($ uid , $ msglist = null , $ fetch_options = null , $ fetch_body = false , $ fetch_attachment = false , $ fetch_flags = true ) {
192193 if (imap_msgno ($ this ->getClient ()->getConnection (), $ uid ) > 0 ) {
@@ -210,8 +211,8 @@ public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_
210211 *
211212 * @return MessageCollection
212213 * @throws Exceptions\ConnectionFailedException
214+ * @throws Exceptions\InvalidWhereQueryCriteriaException
213215 * @throws GetMessagesFailedException
214- * @throws MessageSearchValidationException
215216 */
216217 public function getMessages ($ criteria = 'ALL ' , $ fetch_options = null , $ fetch_body = true , $ fetch_attachment = true , $ fetch_flags = true , $ limit = null , $ page = 1 , $ charset = "UTF-8 " ) {
217218
@@ -234,8 +235,8 @@ public function getMessages($criteria = 'ALL', $fetch_options = null, $fetch_bod
234235 *
235236 * @return MessageCollection
236237 * @throws Exceptions\ConnectionFailedException
238+ * @throws Exceptions\InvalidWhereQueryCriteriaException
237239 * @throws GetMessagesFailedException
238- * @throws MessageSearchValidationException
239240 *
240241 * @deprecated 1.0.5:2.0.0 No longer needed. Use Folder::getMessages('UNSEEN') instead
241242 * @see Folder::getMessages()
@@ -270,8 +271,8 @@ public function getUnseenMessages($criteria = 'UNSEEN', $fetch_options = null, $
270271 * @return MessageCollection
271272 *
272273 * @throws Exceptions\ConnectionFailedException
274+ * @throws Exceptions\InvalidWhereQueryCriteriaException
273275 * @throws GetMessagesFailedException
274- * @throws MessageSearchValidationException
275276 *
276277 * @doc http://php.net/manual/en/function.imap-search.php
277278 * imap_search() only supports IMAP2 search criterias, because the function mail_criteria() (from c-client lib)
@@ -404,6 +405,7 @@ public function move($target_mailbox, $expunge = true) {
404405 * SA_ALL - set all of the above
405406 *
406407 * @return object
408+ * @throws Exceptions\ConnectionFailedException
407409 */
408410 public function getStatus ($ options ) {
409411 return imap_status ($ this ->client ->getConnection (), $ this ->path , $ options );
@@ -417,6 +419,7 @@ public function getStatus($options) {
417419 * @param string $internal_date
418420 *
419421 * @return bool
422+ * @throws Exceptions\ConnectionFailedException
420423 */
421424 public function appendMessage ($ message , $ options = null , $ internal_date = null ) {
422425 return imap_append ($ this ->client ->getConnection (), $ this ->path , $ message , $ options , $ internal_date );
@@ -430,4 +433,16 @@ public function appendMessage($message, $options = null, $internal_date = null)
430433 public function getClient () {
431434 return $ this ->client ;
432435 }
436+
437+
438+ /**
439+ * @param $delimiter
440+ */
441+ public function setDelimiter ($ delimiter ){
442+ if (in_array ($ delimiter , [null , '' , ' ' , false ]) === true ) {
443+ $ delimiter = ClientManager::$ config ['options ' ]['delimiter ' ];
444+ }
445+
446+ $ this ->delimiter = $ delimiter ;
447+ }
433448}
0 commit comments