@@ -94,6 +94,8 @@ public function __construct($config = [])
9494 * Set the Client configuration
9595 *
9696 * @param array $config
97+ *
98+ * @return self
9799 */
98100 public function setConfig (array $ config ) {
99101 $ defaultAccount = config ('imap.default ' );
@@ -102,16 +104,22 @@ public function setConfig(array $config) {
102104 foreach ($ defaultConfig as $ key => $ default ){
103105 $ this ->$ key = isset ($ config [$ key ]) ? $ config [$ key ] : $ default ;
104106 }
107+
108+ return $ this ;
105109 }
106110
107111 /**
108112 * Set read only property and reconnect if it's necessary.
109113 *
110114 * @param bool $readOnly
115+ *
116+ * @return self
111117 */
112118 public function setReadOnly ($ readOnly = true )
113119 {
114120 $ this ->read_only = $ readOnly ;
121+
122+ return $ this ;
115123 }
116124
117125 /**
@@ -243,6 +251,7 @@ public function openFolder(Folder $folder)
243251
244252 /**
245253 * Create a new Folder
254+ *
246255 * @param $name
247256 *
248257 * @return bool
@@ -315,4 +324,94 @@ protected function getAddress()
315324
316325 return $ address ;
317326 }
327+
328+ /**
329+ * Retrieve the quota level settings, and usage statics per mailbox
330+ *
331+ * @return array
332+ */
333+ public function getQuota (){
334+ return imap_get_quota ($ this ->connection , 'user. ' .$ this ->username );
335+ }
336+
337+ /**
338+ * Retrieve the quota settings per user
339+ *
340+ * @param string $quota_root
341+ *
342+ * @return array
343+ */
344+ public function getQuotaRoot ($ quota_root = 'INBOX ' ){
345+ return imap_get_quotaroot ($ this ->connection , $ quota_root );
346+ }
347+
348+ /**
349+ * Gets the number of messages in the current mailbox
350+ *
351+ * @return int
352+ */
353+ public function countMessages (){
354+ return imap_num_msg ($ this ->connection );
355+ }
356+
357+ /**
358+ * Gets the number of recent messages in current mailbox
359+ *
360+ * @return int
361+ */
362+ public function countRecentMessages (){
363+ return imap_num_recent ($ this ->connection );
364+ }
365+
366+ /**
367+ * Returns all IMAP alert messages that have occurred
368+ *
369+ * @return array
370+ */
371+ public function getAlerts (){
372+ return imap_alerts ();
373+ }
374+
375+ /**
376+ * Returns all of the IMAP errors that have occurred
377+ *
378+ * @return array
379+ */
380+ public function getErrors (){
381+ return imap_errors ();
382+ }
383+
384+ /**
385+ * Gets the last IMAP error that occurred during this page request
386+ *
387+ * @return string
388+ */
389+ public function getLastError (){
390+ return imap_last_error ();
391+ }
392+
393+ /**
394+ * Delete all messages marked for deletion
395+ *
396+ * @return bool
397+ */
398+ public function expunge (){
399+ return imap_expunge ($ this ->connection );
400+ }
401+
402+ /**
403+ * Check current mailbox
404+ *
405+ * @return object {
406+ * Date [string(37) "Wed, 8 Mar 2017 22:17:54 +0100 (CET)"] current system time formatted according to » RFC2822
407+ * Driver [string(4) "imap"] protocol used to access this mailbox: POP3, IMAP, NNTP
408+ * Mailbox ["{[email protected] :993/imap/user="[email protected] "}INBOX"] the mailbox name 409+ * Nmsgs [int(1)] number of messages in the mailbox
410+ * Recent [int(0)] number of recent messages in the mailbox
411+ * }
412+ */
413+ public function checkCurrentMailbox (){
414+ return imap_check ($ this ->connection );
415+ }
416+
318417}
0 commit comments