INFRA-132 - Add .jshintrc. Cleanup tests/karama/unit.
[civicrm-core.git] / CRM / Mailing / MailStore.php
index 44740a7064efa01ee7cf707e5e7501c4db404a73..6f3f644ca9d68167a314b7c27e1b34acc6015340 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -39,14 +39,16 @@ class CRM_Mailing_MailStore {
   /**
    * Return the proper mail store implementation, based on config settings
    *
-   * @param  string $name name of the settings set from civimail_mail_settings to use (null for default)
+   * @param string $name
+   *   Name of the settings set from civimail_mail_settings to use (null for default).
    *
    * @throws Exception
-   * @return object        mail store implementation for processing CiviMail-bound emails
+   * @return object
+   *   mail store implementation for processing CiviMail-bound emails
    */
   public static function getStore($name = NULL) {
-    $dao               = new CRM_Core_DAO_MailSettings;
-    $dao->domain_id    = CRM_Core_Config::domainID();
+    $dao = new CRM_Core_DAO_MailSettings();
+    $dao->domain_id = CRM_Core_Config::domainID();
     $name ? $dao->name = $name : $dao->is_default = 1;
     if (!$dao->find(TRUE)) {
       throw new Exception("Could not find entry named $name in civicrm_mail_settings");
@@ -84,25 +86,29 @@ class CRM_Mailing_MailStore {
   /**
    * Return all emails in the mail store
    *
-   * @return array  array of ezcMail objects
+   * @return array
+   *   array of ezcMail objects
    */
-  function allMails() {
+  public function allMails() {
     return $this->fetchNext(0);
   }
 
   /**
    * Expunge the messages marked for deletion; stub function to be redefined by IMAP store
    */
-  function expunge() {}
+  public function expunge() {
+  }
 
   /**
    * Return the next X messages from the mail store
    *
-   * @param int $count  number of messages to fetch (0 to fetch all)
+   * @param int $count
+   *   Number of messages to fetch (0 to fetch all).
    *
-   * @return array      array of ezcMail objects
+   * @return array
+   *   array of ezcMail objects
    */
-  function fetchNext($count = 1) {
+  public function fetchNext($count = 1) {
     if (isset($this->_transport->options->uidReferencing) and $this->_transport->options->uidReferencing) {
       $offset = array_shift($this->_transport->listUniqueIdentifiers());
     }
@@ -115,14 +121,14 @@ class CRM_Mailing_MailStore {
         print "fetching $count messages\n";
       }
     }
-    catch(ezcMailOffsetOutOfRangeException$e) {
+    catch (ezcMailOffsetOutOfRangeException$e) {
       if ($this->_debug) {
         print "got to the end of the mailbox\n";
       }
       return array();
     }
     $mails = array();
-    $parser = new ezcMailParser;
+    $parser = new ezcMailParser();
     //set property text attachment as file CRM-5408
     $parser->options->parseTextAttachmentsAsFiles = TRUE;
 
@@ -139,16 +145,21 @@ class CRM_Mailing_MailStore {
   /**
    * Point to (and create if needed) a local Maildir for storing retrieved mail
    *
-   * @param string $name name of the Maildir
+   * @param string $name
+   *   Name of the Maildir.
    *
    * @throws Exception
-   * @return string       path to the Maildir's cur directory
+   * @return string
+   *   path to the Maildir's cur directory
    */
-  function maildir($name) {
+  public function maildir($name) {
     $config = CRM_Core_Config::singleton();
     $dir = $config->customFileUploadDir . DIRECTORY_SEPARATOR . $name;
     foreach (array(
-      'cur', 'new', 'tmp') as $sub) {
+               'cur',
+               'new',
+               'tmp',
+             ) as $sub) {
       if (!file_exists($dir . DIRECTORY_SEPARATOR . $sub)) {
         if ($this->_debug) {
           print "creating $dir/$sub\n";
@@ -160,5 +171,5 @@ class CRM_Mailing_MailStore {
     }
     return $dir . DIRECTORY_SEPARATOR . 'cur';
   }
-}
 
+}