Merge branch 4.5 into master
[civicrm-core.git] / CRM / Mailing / MailStore / Localdir.php
index 0fc7d476e4ad28f6e7abd83198c5447af4a9838d..dfa634f780ce918ab4d72069482302fbba232e0c 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -44,24 +44,37 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
   /**
    * Connect to the supplied dir and make sure the two mail dirs exist
    *
-   * @param string $dir dir to operate upon
+   * @param string $dir
+   *   Dir to operate upon.
    *
    * @return \CRM_Mailing_MailStore_Localdir
    */
   public function __construct($dir) {
     $this->_dir = $dir;
 
-    $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.ignored', date('Y'), date('m'), date('d'))));
-    $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array('CiviMail.processed', date('Y'), date('m'), date('d'))));
+    $this->_ignored = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+          'CiviMail.ignored',
+          date('Y'),
+          date('m'),
+          date('d'),
+        )));
+    $this->_processed = $this->maildir(implode(DIRECTORY_SEPARATOR, array(
+          'CiviMail.processed',
+          date('Y'),
+          date('m'),
+          date('d'),
+        )));
   }
 
   /**
    * Return the next X messages from the mail store
    * FIXME: in CiviCRM 2.2 this always returns all the emails
    *
-   * @param int $count  number of messages to fetch FIXME: ignored in CiviCRM 2.2 (assumed to be 0, i.e., fetch all)
+   * @param int $count
+   *   Number of messages to fetch FIXME: ignored in CiviCRM 2.2 (assumed to be 0, i.e., fetch all).
    *
-   * @return array      array of ezcMail objects
+   * @return array
+   *   array of ezcMail objects
    */
   public function fetchNext($count = 0) {
     $mails = array();
@@ -78,8 +91,9 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
       if ($entry->isDot()) {
         continue;
       }
-      if (count($mails) >= $count)
-      break;
+      if (count($mails) >= $count) {
+        break;
+      }
 
       $file = $path . DIRECTORY_SEPARATOR . $entry->getFilename();
       if ($this->_debug) {
@@ -87,7 +101,7 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
       }
 
       $set = new ezcMailFileSet(array($file));
-      $parser = new ezcMailParser;
+      $parser = new ezcMailParser();
       //set property text attachment as file CRM-5408
       $parser->options->parseTextAttachmentsAsFiles = TRUE;
 
@@ -95,8 +109,8 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
 
       if (!$mail) {
         return CRM_Core_Error::createAPIError(ts('%1 could not be parsed',
-            array(1 => $file)
-          ));
+          array(1 => $file)
+        ));
       }
       $mails[$file] = $mail[0];
     }
@@ -113,7 +127,8 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
   /**
    * Fetch the specified message to the local ignore folder
    *
-   * @param integer $file file location of the message to fetch
+   * @param int $file
+   *   File location of the message to fetch.
    *
    * @throws Exception
    * @return void
@@ -131,7 +146,8 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
   /**
    * Fetch the specified message to the local processed folder
    *
-   * @param integer $file file location of the message to fetch
+   * @param int $file
+   *   File location of the message to fetch.
    *
    * @throws Exception
    * @return void
@@ -145,4 +161,5 @@ class CRM_Mailing_MailStore_Localdir extends CRM_Mailing_MailStore {
       throw new Exception("Could not rename $file to $target");
     }
   }
+
 }