Merge pull request #16852 from colemanw/bool1
[civicrm-core.git] / CRM / Event / PseudoConstant.php
index c6439a44b8c1e59c81b346bed6e6029be60ba127..d99496720c849571fe0c1388b267738af71cdc75 100644 (file)
@@ -46,8 +46,8 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
 
   /**
    * Participant Listing
-   *
    * @var array
+   * @deprecated
    */
   private static $participantListing;
 
@@ -67,6 +67,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   /**
    * Personal campaign pages
    * @var array
+   * @deprecated
    */
   private static $pcPage;
 
@@ -125,7 +126,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
 
     $index = $cond ? $cond : 'No Condition';
     $index = "{$index}_{$retColumn}";
-    if (!CRM_Utils_Array::value($index, self::$participantStatus)) {
+    if (empty(self::$participantStatus[$index])) {
       self::$participantStatus[$index] = [];
       CRM_Core_PseudoConstant::populate(self::$participantStatus[$index],
         'CRM_Event_DAO_ParticipantStatusType',
@@ -182,7 +183,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
    */
   public static function &participantRole($id = NULL, $cond = NULL) {
     $index = $cond ? $cond : 'No Condition';
-    if (!CRM_Utils_Array::value($index, self::$participantRole)) {
+    if (empty(self::$participantRole[$index])) {
       self::$participantRole[$index] = [];
 
       $condition = NULL;
@@ -205,13 +206,13 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   /**
    * Get all the participant listings.
    *
-   *
+   * @deprecated
    * @param int $id
-   *
    * @return array|string
    *   array reference of all participant listings if any
    */
   public static function &participantListing($id = NULL) {
+    CRM_Core_Error::deprecatedFunctionWarning('Function participantListing will be removed');
     if (!self::$participantListing) {
       self::$participantListing = [];
       self::$participantListing = CRM_Core_OptionGroup::values('participant_listing');
@@ -285,12 +286,13 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
   /**
    * Get all the Personal campaign pages.
    *
-   *
+   * @deprecated
    * @param int $id
    * @return array
    *   array reference of all pcp if any
    */
   public static function &pcPage($id = NULL) {
+    CRM_Core_Error::deprecatedFunctionWarning('Function pcPage will be removed');
     if (!self::$pcPage) {
       CRM_Core_PseudoConstant::populate(self::$pcPage,
         'CRM_PCP_DAO_PCP',
@@ -298,7 +300,7 @@ class CRM_Event_PseudoConstant extends CRM_Core_PseudoConstant {
       );
     }
     if ($id) {
-      return CRM_Utils_Array::value($id, self::$pcPage);
+      return self::$pcPage[$id] ?? NULL;
     }
     return self::$pcPage;
   }