Merge pull request #6170 from colemanw/CRM-16354
[civicrm-core.git] / CRM / Utils / Recent.php
index c5cd36d40e57a015e6454c76f1fc87c623bba1a2..a64c3f2580bd94d9a516d311edf1feb8d9ab2fba 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_Utils_Recent {
 
   /**
-   * Max number of items in queue
+   * Max number of items in queue.
    *
    * @int
    */
   const MAX_ITEMS = 10, STORE_NAME = 'CRM_Utils_Recent';
 
   /**
-   * The list of recently viewed items
+   * The list of recently viewed items.
    *
    * @var array
-   * @static
    */
   static private $_recent = NULL;
 
   /**
-   * Initialize this class and set the static variables
+   * Initialize this class and set the static variables.
    *
    * @return void
-   * @static
    */
   public static function initialize() {
     if (!self::$_recent) {
@@ -71,10 +68,10 @@ class CRM_Utils_Recent {
   }
 
   /**
-   * Return the recently viewed array
+   * Return the recently viewed array.
    *
-   * @return array the recently viewed array
-   * @static
+   * @return array
+   *   the recently viewed array
    */
   public static function &get() {
     self::initialize();
@@ -82,20 +79,23 @@ class CRM_Utils_Recent {
   }
 
   /**
-   * Add an item to the recent stack
+   * Add an item to the recent stack.
    *
-   * @param string $title the title to display
-   * @param string $url the link for the above title
-   * @param string $id object id
+   * @param string $title
+   *   The title to display.
+   * @param string $url
+   *   The link for the above title.
+   * @param string $id
+   *   Object id.
    * @param $type
    * @param int $contactId
    * @param string $contactName
    * @param array $others
    *
    * @return void
-   * @static
    */
-  static function add($title,
+  public static function add(
+    $title,
     $url,
     $id,
     $type,
@@ -144,12 +144,12 @@ class CRM_Utils_Recent {
   }
 
   /**
-   * Delete an item from the recent stack
+   * Delete an item from the recent stack.
    *
-   * @param array $recentItem array of the recent Item to be removed
+   * @param array $recentItem
+   *   Array of the recent Item to be removed.
    *
    * @return void
-   * @static
    */
   public static function del($recentItem) {
     self::initialize();
@@ -160,8 +160,9 @@ class CRM_Utils_Recent {
     // make sure item is not already present in list
     for ($i = 0; $i < count($tempRecent); $i++) {
       if (!($tempRecent[$i]['id'] == $recentItem['id'] &&
-          $tempRecent[$i]['type'] == $recentItem['type']
-        )) {
+        $tempRecent[$i]['type'] == $recentItem['type']
+      )
+      ) {
         self::$_recent[] = $tempRecent[$i];
       }
     }
@@ -171,12 +172,12 @@ class CRM_Utils_Recent {
   }
 
   /**
-   * Delete an item from the recent stack
+   * Delete an item from the recent stack.
    *
-   * @param string $id  contact id that had to be removed
+   * @param string $id
+   *   Contact id that had to be removed.
    *
    * @return void
-   * @static
    */
   public static function delContact($id) {
     self::initialize();
@@ -197,5 +198,5 @@ class CRM_Utils_Recent {
     $session = CRM_Core_Session::singleton();
     $session->set(self::STORE_NAME, self::$_recent);
   }
-}
 
+}