API - add field options to getoptions metadata
[civicrm-core.git] / CRM / Utils / Recent.php
index 1d3bc8b509e4f507e9b275d65ab86e0b558de799..d8b45a323ab31e7cb13a19cd15f8824c493f912b 100644 (file)
@@ -1,8 +1,7 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -24,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
 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';
+  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
-   * @access public
-   * @static
    */
-  static function initialize() {
+  public static function initialize() {
     if (!self::$_recent) {
       $session = CRM_Core_Session::singleton();
       self::$_recent = $session->get(self::STORE_NAME);
@@ -72,33 +68,34 @@ class CRM_Utils_Recent {
   }
 
   /**
-   * Return the recently viewed array
+   * Return the recently viewed array.
    *
-   * @return array the recently viewed array
-   * @access public
-   * @static
+   * @return array
+   *   the recently viewed array
    */
-  static function &get() {
+  public static function &get() {
     self::initialize();
     return self::$_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
-   * @access public
-   * @static
    */
-  static function add($title,
+  public static function add(
+    $title,
     $url,
     $id,
     $type,
@@ -147,15 +144,14 @@ 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
-   * @access public
-   * @static
    */
-  static function del($recentItem) {
+  public static function del($recentItem) {
     self::initialize();
     $tempRecent = self::$_recent;
 
@@ -164,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];
       }
     }
@@ -175,15 +172,14 @@ 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
-   * @access public
-   * @static
    */
-  static function delContact($id) {
+  public static function delContact($id) {
     self::initialize();
 
     $tempRecent = self::$_recent;
@@ -202,5 +198,5 @@ class CRM_Utils_Recent {
     $session = CRM_Core_Session::singleton();
     $session->set(self::STORE_NAME, self::$_recent);
   }
-}
 
+}