(NFC) Bring CRM/Utils folder up to future coder standards
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 7 Apr 2019 01:22:19 +0000 (11:22 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 7 Apr 2019 03:17:33 +0000 (13:17 +1000)
72 files changed:
CRM/Utils/API/AbstractFieldCoder.php
CRM/Utils/API/HTMLInputCoder.php
CRM/Utils/API/MatchOption.php
CRM/Utils/Address/BatchUpdate.php
CRM/Utils/Array.php
CRM/Utils/Cache.php
CRM/Utils/Cache/APCcache.php
CRM/Utils/Cache/ArrayCache.php
CRM/Utils/Cache/ArrayDecorator.php
CRM/Utils/Cache/FastArrayDecorator.php
CRM/Utils/Cache/Memcache.php
CRM/Utils/Cache/Memcached.php
CRM/Utils/Cache/NaiveMultipleTrait.php
CRM/Utils/Cache/NoCache.php
CRM/Utils/Cache/Redis.php
CRM/Utils/Cache/SerializeCache.php
CRM/Utils/Cache/SqlGroup.php
CRM/Utils/Cache/Tiered.php
CRM/Utils/Check/Component.php
CRM/Utils/Check/Component/Env.php
CRM/Utils/Check/Component/PriceFields.php
CRM/Utils/Check/Component/Security.php
CRM/Utils/Date.php
CRM/Utils/DeprecatedUtils.php
CRM/Utils/FakeObject.php
CRM/Utils/File.php
CRM/Utils/GlobalStack.php
CRM/Utils/Hook.php
CRM/Utils/Hook/Joomla.php
CRM/Utils/Hook/Soap.php
CRM/Utils/Hook/UnitTests.php
CRM/Utils/Hook/WordPress.php
CRM/Utils/JS.php
CRM/Utils/Mail.php
CRM/Utils/Migrate/Export.php
CRM/Utils/Migrate/ExportJSON.php
CRM/Utils/Migrate/Import.php
CRM/Utils/Money.php
CRM/Utils/Network.php
CRM/Utils/Number.php
CRM/Utils/OpenFlashChart.php
CRM/Utils/PDF/Document.php
CRM/Utils/PDF/Label.php
CRM/Utils/PDF/Utils.php
CRM/Utils/Pager.php
CRM/Utils/PseudoConstant.php
CRM/Utils/QueryFormatter.php
CRM/Utils/REST.php
CRM/Utils/ReCAPTCHA.php
CRM/Utils/Request.php
CRM/Utils/SQL/BaseParamQuery.php
CRM/Utils/SQL/Insert.php
CRM/Utils/SQL/Select.php
CRM/Utils/SQL/TempTable.php
CRM/Utils/Signer.php
CRM/Utils/SoapServer.php
CRM/Utils/String.php
CRM/Utils/System.php
CRM/Utils/System/Base.php
CRM/Utils/System/DrupalBase.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/Soap.php
CRM/Utils/System/UnitTests.php
CRM/Utils/System/WordPress.php
CRM/Utils/SystemLogger.php
CRM/Utils/Token.php
CRM/Utils/Url.php
CRM/Utils/Verp.php
CRM/Utils/Weight.php
CRM/Utils/Wrapper.php
CRM/Utils/XML.php
CRM/Utils/Zip.php

index e14e23ff4dd7f837aabb79d651acc6aae85ab096..6dfefd8fca668f6847fe39d2f98b53e2df938da2 100644 (file)
@@ -92,7 +92,7 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper {
    *
    * @param array|string $values the field value from the API
    */
-  public abstract function encodeInput(&$values);
+  abstract public function encodeInput(&$values);
 
   /**
    * Decode output.
@@ -101,7 +101,7 @@ abstract class CRM_Utils_API_AbstractFieldCoder implements API_Wrapper {
    *
    * @return mixed
    */
-  public abstract function decodeOutput(&$values);
+  abstract public function decodeOutput(&$values);
 
   /**
    * @inheritDoc
index 91df1ac52222ebd7af4acd71941963d7c6bf218f..bc9a2b51810b789435eb9bc0fe0faa3ba039083d 100644 (file)
@@ -97,19 +97,28 @@ class CRM_Utils_API_HTMLInputCoder extends CRM_Utils_API_AbstractFieldCoder {
         'honor_block_text',
         'pay_later_text',
         'pay_later_receipt',
-        'label', // This is needed for FROM Email Address configuration. dgg
-        'url', // This is needed for navigation items urls
+        // This is needed for FROM Email Address configuration. dgg
+        'label',
+        // This is needed for navigation items urls
+        'url',
         'details',
-        'msg_text', // message templates’ text versions
-        'text_message', // (send an) email to contact’s and CiviMail’s text version
-        'data', // data i/p of persistent table
-        'sqlQuery', // CRM-6673
+        // message templates’ text versions
+        'msg_text',
+        // (send an) email to contact’s and CiviMail’s text version
+        'text_message',
+        // data i/p of persistent table
+        'data',
+        // CRM-6673
+        'sqlQuery',
         'pcp_title',
         'pcp_intro_text',
-        'new', // The 'new' text in word replacements
-        'replyto_email', // e.g. '"Full Name" <user@example.org>'
+        // The 'new' text in word replacements
+        'new',
+        // e.g. '"Full Name" <user@example.org>'
+        'replyto_email',
         'operator',
-        'content', // CRM-20468
+        // CRM-20468
+        'content',
       ];
       $custom = CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_custom_field WHERE html_type = "RichTextEditor"');
       while ($custom->fetch()) {
index 408dd3b8f493767efa199df15c0a57e45a5034ab..0f0cdc8170af64af0ec1d922bb010b646fdf0bac 100644 (file)
@@ -153,7 +153,8 @@ class CRM_Utils_API_MatchOption implements API_Wrapper {
       if ($isMandatory) {
         throw new API_Exception("Failed to match existing record");
       }
-      return $createParams; // OK, don't care
+      // OK, don't care
+      return $createParams;
     }
     elseif ($getResult['count'] == 1) {
       $item = array_shift($getResult['values']);
index 688c8e42372504a93d5aa48aa640c264741500c7..9b16c0d2f4c2b985a6fcf1ef6a76812b9e96141d 100644 (file)
  */
 class CRM_Utils_Address_BatchUpdate {
 
-  var $start = NULL;
-  var $end = NULL;
-  var $geocoding = 1;
-  var $parse = 1;
-  var $throttle = 0;
+  public $start = NULL;
+  public $end = NULL;
+  public $geocoding = 1;
+  public $parse = 1;
+  public $throttle = 0;
 
-  var $returnMessages = [];
-  var $returnError = 0;
+  public $returnMessages = [];
+  public $returnError = 0;
 
   /**
    * Class constructor.
@@ -260,16 +260,16 @@ class CRM_Utils_Address_BatchUpdate {
 
     $this->returnMessages[] = ts("Addresses Evaluated: %1", [
       1 => $totalAddresses,
-      ]) . "\n";
+    ]) . "\n";
     if ($processGeocode) {
       $this->returnMessages[] = ts("Addresses Geocoded: %1", [
-          1 => $totalGeocoded,
-        ]) . "\n";
+        1 => $totalGeocoded,
+      ]) . "\n";
     }
     if ($parseStreetAddress) {
       $this->returnMessages[] = ts("Street Addresses Parsed: %1", [
-          1 => $totalAddressParsed,
-        ]) . "\n";
+        1 => $totalAddressParsed,
+      ]) . "\n";
       if ($unparseableContactAddress) {
         $this->returnMessages[] = "<br />\n" . ts("Following is the list of contacts whose address is not parsed:") . "<br />\n";
         foreach ($unparseableContactAddress as $contactLink) {
index b95b9c4be30569f1fb3db01d8a2deb1bd6f2d6bd..4cda076ea3fc531a289cc4c3276f2fc99f029856 100644 (file)
@@ -1063,7 +1063,8 @@ class CRM_Utils_Array {
       (count($keys) == 1 &&
         (current($keys) > 1 ||
           is_string(current($keys)) ||
-          (current($keys) == 1 && $array[1] == 1) // handle (0 => 4), (1 => 1)
+          // handle (0 => 4), (1 => 1)
+          (current($keys) == 1 && $array[1] == 1)
         )
       )
     ) {
index ee4ac03f3625e017430697bffc7caac26947ef54..23975cae4d2adb302dbc3e40e9c024f967bf1fe7 100644 (file)
@@ -251,7 +251,8 @@ class CRM_Utils_Cache {
    *   Ex: 'ArrayCache', 'Memcache', 'Redis'.
    */
   public static function getCacheDriver() {
-    $className = 'ArrayCache';   // default to ArrayCache for now
+    // default to ArrayCache for now
+    $className = 'ArrayCache';
 
     // Maintain backward compatibility for now.
     // Setting CIVICRM_USE_MEMCACHE or CIVICRM_USE_ARRAYCACHE will
index e18c06121f99e725e3d5092f0b564cb261c265ff..187da7edb801bee1a059c5aa1c7838718186c8e5 100644 (file)
  */
 class CRM_Utils_Cache_APCcache implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
-  use CRM_Utils_Cache_NaiveHasTrait; // TODO Native implementation
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
+  // TODO Native implementation
+  use CRM_Utils_Cache_NaiveHasTrait;
 
   const DEFAULT_TIMEOUT = 3600;
   const DEFAULT_PREFIX = '';
@@ -123,8 +125,10 @@ class CRM_Utils_Cache_APCcache implements CRM_Utils_Cache_Interface {
   public function flush() {
     $allinfo = apc_cache_info('user');
     $keys = $allinfo['cache_list'];
-    $prefix = $this->_prefix;  // Our keys follows this pattern: ([A-Za-z0-9_]+)?CRM_[A-Za-z0-9_]+
-    $lp = strlen($prefix);              // Get prefix length
+    // Our keys follows this pattern: ([A-Za-z0-9_]+)?CRM_[A-Za-z0-9_]+
+    $prefix = $this->_prefix;
+    // Get prefix length
+    $lp = strlen($prefix);
 
     foreach ($keys as $key) {
       $name = $key['info'];
index 47475326f3612e244df22f2a5f7a4104f5a30e0c..92badc0cda9b3edae774ecf2edef9ce17f0fa2c0 100644 (file)
 class CRM_Utils_Cache_Arraycache implements CRM_Utils_Cache_Interface {
 
   use CRM_Utils_Cache_NaiveMultipleTrait;
-  use CRM_Utils_Cache_NaiveHasTrait; // TODO Native implementation
+  // TODO Native implementation
+  use CRM_Utils_Cache_NaiveHasTrait;
 
   const DEFAULT_TIMEOUT = 3600;
 
   /**
    * The cache storage container, an in memory array by default
+   * @var array
    */
   protected $_cache;
 
index c9007070c3cf580d5e6502b8568a4385a24635c4..86ac79728a52e65ffbe3ed41308d3c14ecc27033 100644 (file)
@@ -41,7 +41,8 @@
  */
 class CRM_Utils_Cache_ArrayDecorator implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   /**
    * @var int
index 82ef578d7257d91eeebe820a6854a27e4ebd528f..d0eb1d2a9e00bac553f9d790e09c4dce43d88bbf 100644 (file)
@@ -54,7 +54,8 @@
  */
 class CRM_Utils_Cache_FastArrayDecorator implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   /**
    * @var int
index 3e8057c49d8a6c81e95f608a93e482efb6d1ef3f..511663792e575030897694f495f184a2f505ce73 100644 (file)
@@ -32,7 +32,8 @@
  */
 class CRM_Utils_Cache_Memcache implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   const DEFAULT_HOST = 'localhost';
   const DEFAULT_PORT = 11211;
@@ -163,7 +164,6 @@ class CRM_Utils_Cache_Memcache implements CRM_Utils_Cache_Interface {
     return ($result !== FALSE);
   }
 
-
   /**
    * @param $key
    *
@@ -194,7 +194,8 @@ class CRM_Utils_Cache_Memcache implements CRM_Utils_Cache_Interface {
       $value = $this->_cache->get($key);
       if ($value === FALSE) {
         $value = uniqid();
-        $this->_cache->set($key, $value, FALSE, 0); // Indefinite.
+        // Indefinite.
+        $this->_cache->set($key, $value, FALSE, 0);
       }
       $this->_truePrefix = [
         'value' => $value,
index eeed41cc14cdc5a69ac00111dd28836b78a1d1a3..fd3aee39c236fe795e16141fab26cc9d5b05361c 100644 (file)
@@ -32,7 +32,8 @@
  */
 class CRM_Utils_Cache_Memcached implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   const DEFAULT_HOST = 'localhost';
   const DEFAULT_PORT = 11211;
@@ -227,7 +228,8 @@ class CRM_Utils_Cache_Memcached implements CRM_Utils_Cache_Interface {
     $maxLen = self::MAX_KEY_LEN - strlen($truePrefix);
     $key = preg_replace('/\s+|\W+/', '_', $key);
     if (strlen($key) > $maxLen) {
-      $md5Key = md5($key);  // this should be 32 characters in length
+      // this should be 32 characters in length
+      $md5Key = md5($key);
       $subKeyLen = $maxLen - 1 - strlen($md5Key);
       $key = substr($key, 0, $subKeyLen) . "_" . $md5Key;
     }
@@ -256,7 +258,8 @@ class CRM_Utils_Cache_Memcached implements CRM_Utils_Cache_Interface {
       $value = $this->_cache->get($key);
       if ($this->_cache->getResultCode() === Memcached::RES_NOTFOUND) {
         $value = uniqid();
-        $this->_cache->add($key, $value, 0); // Indefinite.
+        // Indefinite.
+        $this->_cache->add($key, $value, 0);
       }
       $this->_truePrefix = [
         'value' => $value,
index 16916f2a71ef6bafbb43b97a66cd058873f2db09..14914d964b9cbc1f66e185637f56b8baa8b2f2cb 100644 (file)
@@ -109,6 +109,7 @@ trait CRM_Utils_Cache_NaiveMultipleTrait {
   }
 
   /**
+   * @param $func
    * @param $keys
    * @throws \CRM_Utils_Cache_InvalidArgumentException
    */
index 9d39503782c7c603ddfdf48379a691b8dd003abf..42921bd7c8b0d432e07ec9ba8c2498eecd5dfedd 100644 (file)
  */
 class CRM_Utils_Cache_NoCache implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
-  use CRM_Utils_Cache_NaiveHasTrait; // TODO Native implementation
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
+  // TODO Native implementation
+  use CRM_Utils_Cache_NaiveHasTrait;
 
   /**
    * We only need one instance of this object. So we use the singleton
index 1b64e42881b41729dd54ab521d43a891115ca9d5..f7c8435f791eac16f84e69e15d2fc304ec12446e 100644 (file)
  */
 class CRM_Utils_Cache_Redis implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
-  use CRM_Utils_Cache_NaiveHasTrait; // TODO Native implementation
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
+  // TODO Native implementation
+  use CRM_Utils_Cache_NaiveHasTrait;
 
   const DEFAULT_HOST    = 'localhost';
   const DEFAULT_PORT    = 6379;
@@ -76,7 +78,8 @@ class CRM_Utils_Cache_Redis implements CRM_Utils_Cache_Interface {
   public static function connect($config) {
     $host = isset($config['host']) ? $config['host'] : self::DEFAULT_HOST;
     $port = isset($config['port']) ? $config['port'] : self::DEFAULT_PORT;
-    $pass = CRM_Utils_Constant::value('CIVICRM_DB_CACHE_PASSWORD'); // Ugh.
+    // Ugh.
+    $pass = CRM_Utils_Constant::value('CIVICRM_DB_CACHE_PASSWORD');
     $id = implode(':', ['connect', $host, $port /* $pass is constant */]);
     if (!isset(Civi::$statics[__CLASS__][$id])) {
       // Ideally, we'd track the connection in the service-container, but the
index 3b1cf9517e6c6d7bec1df765bae82c6df0b4122c..f17b4591076e7a4f96935986a7654b0d03a943d3 100644 (file)
 class CRM_Utils_Cache_SerializeCache implements CRM_Utils_Cache_Interface {
 
   use CRM_Utils_Cache_NaiveMultipleTrait;
-  use CRM_Utils_Cache_NaiveHasTrait; // TODO Native implementation
+  // TODO Native implementation
+  use CRM_Utils_Cache_NaiveHasTrait;
 
   /**
    * The cache storage container, an array by default, stored in a file under templates
+   * @var array
    */
   private $_cache;
 
@@ -101,7 +103,8 @@ class CRM_Utils_Cache_SerializeCache implements CRM_Utils_Cache_Interface {
       throw new \RuntimeException("FIXME: " . __CLASS__ . "::set() should support non-NULL TTL");
     }
     if (file_exists($this->fileName($key))) {
-      return FALSE; // WTF, write-once cache?!
+      // WTF, write-once cache?!
+      return FALSE;
     }
     $this->_cache[$key] = $value;
     $bytes = file_put_contents($this->fileName($key), "<?php //" . serialize($value));
@@ -127,7 +130,8 @@ class CRM_Utils_Cache_SerializeCache implements CRM_Utils_Cache_Interface {
   public function flush($key = NULL) {
     $prefix = "CRM_";
     if (!$handle = opendir(CIVICRM_TEMPLATE_COMPILEDIR)) {
-      return FALSE; // die? Error?
+      // die? Error?
+      return FALSE;
     }
     while (FALSE !== ($entry = readdir($handle))) {
       if (substr($entry, 0, 4) == $prefix) {
index 0c1a2c22bd79c2e049942714f233edc0d7ebd9b4..19285de17f978e3aed2897e629f72ad8d844e034 100644 (file)
@@ -42,7 +42,8 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
   const DEFAULT_TTL = 21600;
 
   const TS_FMT = 'Y-m-d H:i:s';
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   /**
    * The host name of the memcached server.
@@ -52,7 +53,7 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface {
   protected $group;
 
   /**
-   * @var int $componentID The optional component ID (so componenets can share the same name space)
+   * @var int
    */
   protected $componentID;
 
index 04fc4700162e8f64900ab60c85d45995c6adfcb0..5cc8d78c3b3895b584aea69d9654f65d068a5654 100644 (file)
@@ -62,7 +62,8 @@
  */
 class CRM_Utils_Cache_Tiered implements CRM_Utils_Cache_Interface {
 
-  use CRM_Utils_Cache_NaiveMultipleTrait; // TODO Consider native implementation.
+  // TODO Consider native implementation.
+  use CRM_Utils_Cache_NaiveMultipleTrait;
 
   /**
    * @var array
index 528880d874ca9b891497e829b20595165d67fdb7..a3818e8ea3a4d72dae1372778c59458ff6575f3f 100644 (file)
@@ -25,7 +25,6 @@
  +--------------------------------------------------------------------+
  */
 
-use GuzzleHttp\Client;
 
 /**
  *
@@ -62,7 +61,8 @@ abstract class CRM_Utils_Check_Component {
   /**
    * Check if file exists on given URL.
    *
-   * @param $url
+   * @param string $url
+   * @param int $timeout
    * @return bool
    * @throws \GuzzleHttp\Exception\GuzzleException
    */
index 45703cd26512c4231617c3e1b61b7f7b7fd9ee98..cbc58df44c1c91166aaf7ad0a84d6c1136ad823f 100644 (file)
@@ -618,12 +618,12 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
         case CRM_Extension_Manager::STATUS_INSTALLED:
           if (!empty($remotes[$key]) && version_compare($row['version'], $remotes[$key]->version, '<')) {
             $updates[] = ts('%1 (%2) version %3 is installed. <a %4>Upgrade to version %5</a>.', [
-                1 => CRM_Utils_Array::value('label', $row),
-                2 => $key,
-                3 => $row['version'],
-                4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"',
-                5 => $remotes[$key]->version,
-              ]);
+              1 => CRM_Utils_Array::value('label', $row),
+              2 => $key,
+              3 => $row['version'],
+              4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"',
+              5 => $remotes[$key]->version,
+            ]);
           }
           else {
             if (empty($row['label'])) {
@@ -692,7 +692,6 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
     return $messages;
   }
 
-
   /**
    * Checks if there are pending extension upgrades.
    *
index 47e325cfe034aaeb429f545ab44dad3f7f3dd364..4261c95a8d1961898c6793330319f2c0f72beb98 100644 (file)
@@ -53,7 +53,8 @@ class CRM_Utils_Check_Component_PriceFields extends CRM_Utils_Check_Component {
       $url = CRM_Utils_System::url('civicrm/admin/price/field', [
         'reset' => 1,
         'action' => 'browse',
-        'sid' => $dao->ps_id]);
+        'sid' => $dao->ps_id,
+      ]);
       $html .= "<tr><td>$dao->ps_title</td><td>$dao->psf_label</td><td><a href='$url'>View Price Set Fields</a></td></tr>";
     }
     if ($count > 0) {
index 984bf5fc3a0efa11d3cc834da7f8a84d6bf52811..c0291e50d98dc54305a0553e3087776b3d67f9a9 100644 (file)
@@ -202,7 +202,6 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component {
     return $messages;
   }
 
-
   /**
    * Check that some files are not present.
    *
@@ -276,7 +275,6 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component {
     return $messages;
   }
 
-
   /**
    * Check that the sysadmin has not modified the Cxn
    * security setup.
index 913c930a4559b67c7b8d0ce3cb2c8b5876b25419..24b2f7388072276ff11abec6307c7d3a34ba6b84 100644 (file)
@@ -763,7 +763,6 @@ class CRM_Utils_Date {
     }
   }
 
-
   /**
    * @param null $timeStamp
    *
@@ -901,7 +900,7 @@ class CRM_Utils_Date {
    * @return int
    *   array $results contains years or months
    */
-  static public function calculateAge($birthDate) {
+  public static function calculateAge($birthDate) {
     $results = [];
     $formatedBirthDate = CRM_Utils_Date::customFormat($birthDate, '%Y-%m-%d');
 
@@ -1858,9 +1857,9 @@ class CRM_Utils_Date {
     }
 
     foreach ([
-               'from',
-               'to',
-             ] as $item) {
+      'from',
+      'to',
+    ] as $item) {
       if (!empty($$item)) {
         $dateRange[$item] = self::format($$item);
       }
@@ -1961,7 +1960,6 @@ class CRM_Utils_Date {
     return $field;
   }
 
-
   /**
    * Get the fields required for the 'extra' parameter when adding a datepicker.
    *
@@ -2170,7 +2168,6 @@ class CRM_Utils_Date {
     return $month;
   }
 
-
   /**
    * Convert a relative date format to an api field.
    *
index e05a690cd83e10102166b86e6e42481a39da47f5..9d2d7ca4e088bdde203ebdef084341a564524237 100644 (file)
@@ -780,12 +780,12 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) {
     }
 
     foreach ([
-               'Phone',
-               'Email',
-               'IM',
-               'OpenID',
-               'Phone_Ext',
-             ] as $block) {
+      'Phone',
+      'Email',
+      'IM',
+      'OpenID',
+      'Phone_Ext',
+    ] as $block) {
       $name = strtolower($block);
       if (!array_key_exists($name, $values)) {
         continue;
@@ -1063,7 +1063,6 @@ function _civicrm_api3_deprecated_validate_formatted_contact(&$params) {
   return civicrm_api3_create_success(TRUE);
 }
 
-
 /**
  * @deprecated - this is part of the import parser not the API & needs to be moved on out
  *
index d119548e3cf0ec7ecd20dd11db63dbcd9bf26f84..83823708f8091d5e2e50085a8b672d0cce20a46b 100644 (file)
@@ -43,6 +43,7 @@
  * @endcode
  */
 class CRM_Utils_FakeObject {
+
   /**
    * @param $array
    */
index d9040ffc0f639c9aeae062a2d3dbfda0983c3565..b51905f71496dfb2ae0e9d56a922130476bd2322 100644 (file)
@@ -797,7 +797,8 @@ HTACCESS;
       }
     }
     if (empty($childParts)) {
-      return FALSE; // same directory
+      // same directory
+      return FALSE;
     }
     else {
       return TRUE;
index 50bf3c268a1bb48f175d8099877ecb67bf55b973..0884e3b134c454075ec43985e31ebadf49e60331 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Utils_GlobalStack {
    *
    * @return CRM_Utils_GlobalStack
    */
-  static public function singleton() {
+  public static function singleton() {
     if (self::$_singleton === NULL) {
       self::$_singleton = new CRM_Utils_GlobalStack();
     }
index c4c8cd0ae98b3891eecb20265a7998b13d51b90f..8282a89c7ca20d5e04987b56402c8a18d0dc4995 100644 (file)
@@ -44,10 +44,15 @@ abstract class CRM_Utils_Hook {
   const SUMMARY_BELOW = 1;
   // place hook content above
   const SUMMARY_ABOVE = 2;
-  // create your own summaries
+  /**
+   *create your own summaries
+   */
   const SUMMARY_REPLACE = 3;
 
-  static $_nullObject = NULL;
+  /**
+   * @var ojbect
+   */
+  public static $_nullObject = NULL;
 
   /**
    * We only need one instance of this object. So we use the singleton
@@ -123,7 +128,7 @@ abstract class CRM_Utils_Hook {
    *
    * @return mixed
    */
-  public abstract function invokeViaUF(
+  abstract public function invokeViaUF(
     $numParams,
     &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
     $fnSuffix
@@ -1596,6 +1601,7 @@ abstract class CRM_Utils_Hook {
       'civicrm_triggerInfo'
     );
   }
+
   /**
    * This hook allows changes to the spec of which tables to log.
    *
@@ -1862,7 +1868,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * @param CRM_Core_Exception Exception $exception
+   * @param CRM_Core_ExceptionObject $exception
    * @param mixed $request
    *   Reserved for future use.
    */
@@ -1981,7 +1987,6 @@ abstract class CRM_Utils_Hook {
       ->invoke(['labelName', 'label', 'format', 'participant'], $labelName, $label, $format, $participant, self::$_nullObject, self::$_nullObject, 'civicrm_alterBadge');
   }
 
-
   /**
    * This hook is called before encoding data in barcode.
    *
@@ -2290,7 +2295,7 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * @param array <CRM_Core_FileSearchInterface> $fileSearches
+   * @param array $fileSearches CRM_Core_FileSearchInterface
    * @return mixed
    */
   public static function fileSearches(&$fileSearches) {
@@ -2426,8 +2431,8 @@ abstract class CRM_Utils_Hook {
   /**
    * This hook is called before an inbound SMS is processed.
    *
-   * @param CRM_SMS_Message Object $message
-   *   An SMS message recieved
+   * @param \CRM_SMS_MessageObject $message
+   *   An SMS message received
    * @return mixed
    */
   public static function inboundSMS(&$message) {
@@ -2438,7 +2443,7 @@ abstract class CRM_Utils_Hook {
    * This hook is called to modify api params of EntityRef form field
    *
    * @param array $params
-   *
+   * @param string $formName
    * @return mixed
    */
   public static function alterEntityRefParams(&$params, $formName) {
index d0448e948b4c735c1b14740e298a811048322f59..eb2f7b0c774e956a784ec683627c47f673859429 100644 (file)
@@ -53,6 +53,7 @@ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook {
    *
    * @return mixed
    */
+
   /**
    * @param int $numParams
    * @param mixed $arg1
index fe6274e6175bd9d5745d657dbf10b3c843bbae80..99e3522d759c81743e2f8281a5e9db57b197308c 100644 (file)
@@ -53,6 +53,7 @@ class CRM_Utils_Hook_Soap extends CRM_Utils_Hook {
    *
    * @return mixed
    */
+
   /**
    * @param int $numParams
    * @param mixed $arg1
index 39f35eac1a1e4b6fa3fa3268385653bba159801e..f5fa1400a913dc2234bccef2ec47e19998623a14 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
   protected $mockObject;
 
   /**
-   * @var array $adhocHooks to call
+   * @var array
    */
   protected $adhocHooks;
   protected $civiModules = NULL;
index 2b7bc5bd7c6377add1f5018ca3014337f4367537..ba032151bafa26e99967a0fa9402e1f588f3759e 100644 (file)
@@ -160,7 +160,6 @@ class CRM_Utils_Hook_WordPress extends CRM_Utils_Hook {
 
   }
 
-
   /**
    * Build the list of plugins ("modules" in CiviCRM terminology) to be processed for hooks.
    *
index f6d6710e979867f73da0600181ede1c8943d6034..95340e36a38b6f7cdecb619d3a9a60c5529aa3e6 100644 (file)
@@ -32,6 +32,7 @@
  * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Utils_JS {
+
   /**
    * Parse a javascript file for translatable strings.
    *
index 539b7605237d8ddf194344061a5d692e71923349..ca7526bf37a314ceb0f769fddc7690c58c910b71 100644 (file)
@@ -319,8 +319,8 @@ class CRM_Utils_Mail {
    */
   public static function errorMessage($mailer, $result) {
     $message = '<p>' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', [
-        1 => 'SMTP',
-      ]) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM &raquo; System Settings &raquo; Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
+      1 => 'SMTP',
+    ]) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM &raquo; System Settings &raquo; Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
 
     if (is_a($mailer, 'Mail_smtp')) {
       $message .= '<ul>' . '<li>' . ts('Your SMTP Username or Password are incorrect.') . '</li>' . '<li>' . ts('Your SMTP Server (machine) name is incorrect.') . '</li>' . '<li>' . ts('You need to use a Port other than the default port 25 in your environment.') . '</li>' . '<li>' . ts('Your SMTP server is just not responding right now (it is down for some reason).') . '</li>';
@@ -330,8 +330,8 @@ class CRM_Utils_Mail {
     }
 
     $message .= '<li>' . ts('The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.') . '</li>' . '</ul>' . '<p>' . ts('Check <a href="%1">this page</a> for more information.', [
-        1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE),
-      ]) . '</p>';
+      1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE),
+    ]) . '</p>';
 
     return $message;
   }
index c6b372fc15d632cb76a8b4b62a79b4e7da46622c..7497fb962a49714df87f4b9330d977b056805f9b 100644 (file)
@@ -475,14 +475,14 @@ class CRM_Utils_Migrate_Export {
         // hack for extends_entity_column_value
         if ($name == 'extends_entity_column_value') {
           if (in_array($object->extends, [
-              'Event',
-              'Activity',
-              'Relationship',
-              'Individual',
-              'Organization',
-              'Household',
-              'Case',
-            ])) {
+            'Event',
+            'Activity',
+            'Relationship',
+            'Individual',
+            'Organization',
+            'Household',
+            'Case',
+          ])) {
             if ($object->extends == 'Event') {
               $key = 'event_type';
             }
index b9adff7887427b3ad5712ba71a64cfbeddaaa69b..ffaa63065b77d5fbe970e6edc4ee9ab83d62bffe 100644 (file)
@@ -434,9 +434,9 @@ AND    entity_table = 'civicrm_contact'
       $this->appendValue($dao->id, 'civicrm_relationship', $relationship);
 
       $this->addAdditionalContacts([
-          $dao->contact_id_a,
-          $dao->contact_id_b,
-        ],
+        $dao->contact_id_a,
+        $dao->contact_id_b,
+      ],
         $additionalContacts
       );
     }
index 0a25d24bc7ab8ae1f3c4c54f51006370677001d0..340e10d51a6d154471cea5f5f05a44d0434f820e 100644 (file)
@@ -31,6 +31,7 @@
  * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Utils_Migrate_Import {
+
   /**
    * Class constructor.
    */
index 77606d7061a4d21b5eb5837fe0caf7b050cbf190..ce15b9995bfa52a763035371e66cab358b3271e4 100644 (file)
@@ -35,7 +35,7 @@
  * Money utilties
  */
 class CRM_Utils_Money {
-  static $_currencySymbols = NULL;
+  public static $_currencySymbols = NULL;
 
   /**
    * Format a monetary string.
@@ -87,9 +87,9 @@ class CRM_Utils_Money {
 
     if (!self::$_currencySymbols) {
       self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', [
-          'keyColumn' => 'name',
-          'labelColumn' => 'symbol',
-        ]);
+        'keyColumn' => 'name',
+        'labelColumn' => 'symbol',
+      ]);
     }
 
     if (!$currency) {
index 0564590867a68322f8e7726bc53bb907568d2ecf..0a256816b04784f722731943421ad3d062a731e4 100644 (file)
@@ -34,6 +34,7 @@
  * Simple static helpers for network operations
  */
 class CRM_Utils_Network {
+
   /**
    * Try connecting to a TCP service; if it fails, retry. Repeat until serverStartupTimeOut elapses.
    *
index 619c8118d34e5a5b633a4bf1d2131c2691ca73d9..02e31ad96a5790c7167dcf24829eb911d1036b6a 100644 (file)
@@ -34,6 +34,7 @@
  * Class CRM_Utils_Number
  */
 class CRM_Utils_Number {
+
   /**
    * Create a random number with a given precision.
    *
@@ -64,13 +65,16 @@ class CRM_Utils_Number {
   public static function createTruncatedDecimal($keyValue, $precision) {
     list ($sigFigs, $decFigs) = $precision;
     $sign = ($keyValue < 0) ? '-1' : 1;
-    $val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 123456
-    $val = substr($val, 0, $sigFigs);            // ex: 123456 => 1234
+    // ex: -123.456 ==> 123456
+    $val = str_replace('.', '', abs($keyValue));
+    // ex: 123456 => 1234
+    $val = substr($val, 0, $sigFigs);
 
     // Move any extra digits after decimal
     $extraFigs = strlen($val) - ($sigFigs - $decFigs);
     if ($extraFigs > 0) {
-      return $sign * $val / pow(10, $extraFigs); // ex: 1234 => 1.234
+      // ex: 1234 => 1.234
+      return $sign * $val / pow(10, $extraFigs);
     }
     else {
       return $sign * $val;
index 9f0b8f2db42ed79793c16658af296a80975aa74a..26e34292ebfcbab0f338e35dd5c76278ff1457fa 100644 (file)
@@ -470,10 +470,10 @@ class CRM_Utils_OpenFlashChart {
 
     // carry some chart params if pass.
     foreach ([
-               'xSize',
-               'ySize',
-               'divName',
-             ] as $f) {
+      'xSize',
+      'ySize',
+      'divName',
+    ] as $f) {
       if (!empty($rows[$f])) {
         $chartData[$f] = $rows[$f];
       }
@@ -510,10 +510,10 @@ class CRM_Utils_OpenFlashChart {
 
     // carry some chart params if pass.
     foreach ([
-               'xSize',
-               'ySize',
-               'divName',
-             ] as $f) {
+      'xSize',
+      'ySize',
+      'divName',
+    ] as $f) {
       if (!empty($rows[$f])) {
         $chartData[$f] = $rows[$f];
       }
index 2fa43b4a43889564f3fcd3d596afa947a1335c2d..25490c9bb004c0b42e662f107e8e969230df5e2f 100644 (file)
@@ -124,7 +124,8 @@ class CRM_Utils_PDF_Document {
       $phpWord = \PhpOffice\PhpWord\IOFactory::load($fileName, $formats[$ext]);
     }
 
-    \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(TRUE); //CRM-20015
+    //CRM-20015
+    \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(TRUE);
     $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $formats[$ext]);
 
     CRM_Utils_System::setHttpHeader('Content-Type', "application/$ext");
@@ -147,7 +148,7 @@ class CRM_Utils_PDF_Document {
    * @param string $type  File type
    *
    * @return array
-   *    Return extracted content of document in HTML and document type
+   *   Return extracted content of document in HTML and document type
    */
   public static function docReader($path, $type) {
     $type = array_search($type, CRM_Core_SelectValues::documentApplicationType());
index df5f935fb97f203eb93982979fc728292153c78a..1dc7caad170c49024b8e5e76c0fa175f121cedb7 100644 (file)
@@ -40,51 +40,120 @@ class CRM_Utils_PDF_Label extends TCPDF {
 
   // make these properties public due to
   // CRM-5880
-  // Default label format values
+  /**
+   * Default label format values
+   * @var array
+   */
   public $defaults;
-  // Current label format values
+  /**
+   * Current label format values
+   * @var array
+   */
   public $format;
-  // Name of format
+  /**
+   * Name of format
+   * @var string
+   */
   public $formatName;
-  // Left margin of labels
+  /**
+   * Left margin of labels
+   * @var float
+   */
   public $marginLeft;
-  // Top margin of labels
+  /**
+   * Top margin of labels
+   * @var float
+   */
   public $marginTop;
-  // Horizontal space between 2 labels
+  /**
+   * Horizontal space between 2 labels
+   * @var float
+   */
   public $xSpace;
-  // Vertical space between 2 labels
+  /**
+   * Vertical space between 2 labels
+   * @var float
+   */
   public $ySpace;
-  // Number of labels horizontally
+  /**
+   * Number of labels horizontally
+   * @var float
+   */
   public $xNumber;
-  // Number of labels vertically
+  /**
+   * Number of labels vertically
+   * @var float
+   */
   public $yNumber;
-  // Width of label
+  /**
+   * Width of label
+   * @var float
+   */
   public $width;
-  // Height of label
+  /**
+   * Height of label
+   * @var float
+   */
   public $height;
-  // Line Height of label - used in event code
+  /**
+   * Line Height of label - used in event code
+   * @var float
+   */
   public $lineHeight = 0;
-  // Space between text and left edge of label
+  /**
+   * Space between text and left edge of label
+   * @var float
+   */
   public $paddingLeft;
-  // Space between text and top edge of label
+  /**
+   * Space between text and top edge of label
+   * @var float
+   */
   public $paddingTop;
-  // Character size (in points)
+  /**
+   * Character size (in points)
+   * @var float
+   */
   public $charSize;
-  // Metric used for all PDF doc measurements
+  /**
+   * Metric used for all PDF doc measurements
+   * @var string
+   */
   public $metricDoc;
-  // Name of the font
+  /**
+   * Name of the font
+   * @var string
+   */
   public $fontName;
-  // 'B' bold, 'I' italic, 'BI' bold+italic
+  /**
+   * 'B' bold, 'I' italic, 'BI' bold+italic
+   * @var string
+   */
   public $fontStyle;
-  // Paper size name
+  /**
+   * Paper size name
+   * @var string
+   */
   public $paperSize;
-  // Paper orientation
+  /**
+   * Paper orientation
+   * @var string
+   */
   public $orientation;
-  // Paper dimensions array (w, h)
+  /**
+   * Paper dimensions array (w, h)
+   * @var array
+   */
   public $paper_dimensions;
-  // Counter for positioning labels
+  /**
+   * Counter for positioning labels
+   * @var float
+   */
   public $countX = 0;
-  // Counter for positioning labels
+  /**
+   * Counter for positioning labels
+   * @var float
+   */
   public $countY = 0;
 
   /**
index 72c0d6c5bffeba1df5a01fc21f0d920b9712d972..7694dc24c748e06f9fcf7013d5806eedb5366020 100644 (file)
@@ -28,6 +28,7 @@
 
 use Dompdf\Dompdf;
 use Dompdf\Options;
+
 /**
  *
  * @package CRM
@@ -141,7 +142,8 @@ class CRM_Utils_PDF_Utils {
     // This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
     // Syntax borrowed from https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc
     require_once 'tcpdf/tcpdf.php';
-    require_once 'FPDI/fpdi.php'; // This library is only in the 'packages' area as of version 4.5
+    // This library is only in the 'packages' area as of version 4.5
+    require_once 'FPDI/fpdi.php';
 
     $paper_size_arr = [$paper_size[2], $paper_size[3]];
 
index 74f8afee2da9c5b83685cbbc8fd77762f7d86297..390764d766ac0c20a114b5c932b0a9f3aed6cf4f 100644 (file)
@@ -112,13 +112,13 @@ class CRM_Utils_Pager extends Pager_Sliding {
      * page variable, but a different form element for one at the bottom.
      */
     $this->_response['titleTop'] = ts('Page %1 of %2', [
-        1 => '<input size="2" maxlength="4" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />',
-        2 => $this->_response['numPages'],
-      ]);
+      1 => '<input size="2" maxlength="4" name="' . self::PAGE_ID . '" type="text" value="' . $this->_response['currentPage'] . '" />',
+      2 => $this->_response['numPages'],
+    ]);
     $this->_response['titleBottom'] = ts('Page %1 of %2', [
-        1 => '<input size="2" maxlength="4" name="' . self::PAGE_ID_BOTTOM . '" type="text" value="' . $this->_response['currentPage'] . '" />',
-        2 => $this->_response['numPages'],
-      ]);
+      1 => '<input size="2" maxlength="4" name="' . self::PAGE_ID_BOTTOM . '" type="text" value="' . $this->_response['currentPage'] . '" />',
+      2 => $this->_response['numPages'],
+    ]);
   }
 
   /**
index 4ccbdba0dedf6f707e5f9e3e28374352b8f23617..7a3cf0d54768bdeb8bbdbfae97b5e5bb908ecd5e 100644 (file)
@@ -36,6 +36,7 @@
 class CRM_Utils_PseudoConstant {
   /**
    * CiviCRM pseudoconstant classes for wrapper functions.
+   * @var array
    */
   private static $constantClasses = [
     'CRM_Core_PseudoConstant',
index 863226ea15adb19898221dbacd1c6f7f05593ff5..9c4b49ee59be56a58bb114c1e30e386f65a44e20 100644 (file)
@@ -88,6 +88,9 @@ class CRM_Utils_QueryFormatter {
    */
   const MODE_WILDWORDS_SUFFIX = 'wildwords-suffix';
 
+  /**
+   * @var \CRM_Utils_QueryFormatter|NULL
+   */
   static protected $singleton;
 
   /**
@@ -407,8 +410,8 @@ class CRM_Utils_QueryFormatter {
   }
 
   /**
-   * @param $text
-   * @bool $quotes
+   * @param string $text
+   * @param bool $quotes
    * @return array
    */
   protected function parseWords($text, $quotes) {
index 52e7e5296484fcd5e05c915bbeea2041b6ead058..b1df33aee17c6d583a57a8b0e7c3749ad1ae6033 100644 (file)
@@ -35,11 +35,13 @@ class CRM_Utils_REST {
 
   /**
    * Number of seconds we should let a REST process idle
+   * @var int
    */
-  static $rest_timeout = 0;
+  public static $rest_timeout = 0;
 
   /**
    * Cache the actual UF Class
+   * @var string
    */
   public $ufClass;
 
@@ -399,8 +401,10 @@ class CRM_Utils_REST {
       CRM_Utils_System::setHttpHeader("Status", "404 Not Found");
       die("Can't find the requested template file templates/$tpl");
     }
-    if (array_key_exists('id', $_GET)) {// special treatmenent, because it's often used
-      $smarty->assign('id', (int) $_GET['id']);// an id is always positive
+    // special treatmenent, because it's often used
+    if (array_key_exists('id', $_GET)) {
+      // an id is always positive
+      $smarty->assign('id', (int) $_GET['id']);
     }
     $pos = strpos(implode(array_keys($_GET)), '<');
 
@@ -480,7 +484,8 @@ class CRM_Utils_REST {
 
     $params['check_permissions'] = TRUE;
     $params['version'] = 3;
-    $_GET['json'] = $requestParams['json'] = 1; // $requestParams is local-only; this line seems pointless unless there's a side-effect influencing other functions
+    // $requestParams is local-only; this line seems pointless unless there's a side-effect influencing other functions
+    $_GET['json'] = $requestParams['json'] = 1;
     if (!$params['sequential']) {
       $params['sequential'] = 1;
     }
@@ -597,7 +602,8 @@ class CRM_Utils_REST {
     if (!empty($q)) {
       if (count($args) == 2 && $args[1] == 'ping') {
         CRM_Utils_System::loadBootStrap([], FALSE, FALSE);
-        return NULL; // this is pretty wonky but maybe there's some reason I can't see
+        // this is pretty wonky but maybe there's some reason I can't see
+        return NULL;
       }
       if (count($args) != 3) {
         return self::error('ERROR: Malformed REST path');
index d1afe457a1c785ae8a2935725dd877f839676f71..31980430149b6dd4364f04e586d2f3aae921aef2 100644 (file)
@@ -62,7 +62,6 @@ class CRM_Utils_ReCAPTCHA {
     return self::$_singleton;
   }
 
-
   /**
    * Check if reCaptcha settings is avilable to add on form.
    */
index a435d65a7cf807ebacba2f1c583ad521d04f305c..2f55cea32c37c20e9a75092b28fe092f94c7d82e 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Utils_Request {
    * @param array $method - '$_GET', '$_POST' or '$_REQUEST'.
    *
    * @return mixed
-   *    The value of the variable
+   *   The value of the variable
    */
   protected static function getValue($name, $method) {
     if (isset($method[$name])) {
@@ -235,7 +235,7 @@ class CRM_Utils_Request {
    * @param array $attributes
    *   The form attributes array.
    *
-   * @return string $value
+   * @return string
    *   The desired value.
    */
   public static function retrieveComponent($attributes) {
index c2a61422b3d92e8be38ad9c24db9c404cf800f74..f48d05556c6de6ba1e89153729ad5a187e215666 100644 (file)
@@ -36,11 +36,20 @@ class CRM_Utils_SQL_BaseParamQuery implements ArrayAccess {
    */
   const INTERPOLATE_AUTO = 'auto';
 
+  /**
+   * @var mixed
+   */
   protected $mode = NULL;
 
+  /**
+   * @var array
+   */
   protected $params = [];
 
-  // Public to work-around PHP 5.3 limit.
+  /**
+   * Public to work-around PHP 5.3 limit.
+   * @var bool
+   */
   public $strict = NULL;
 
   /**
index c06bd601c1bf621e5b2502f2733213d8d2021671..816c89f605d0079eb949a02d1e2be230c31473f5 100644 (file)
@@ -36,6 +36,7 @@ class CRM_Utils_SQL_Insert {
 
   /**
    * Array<string> list of column names
+   * @var array
    */
   private $columns;
 
@@ -62,7 +63,8 @@ class CRM_Utils_SQL_Insert {
     $row = [];
     foreach ((array) $dao as $key => $value) {
       if ($value === 'null') {
-        $value = NULL; // Blerg!!!
+        // Blerg!!!
+        $value = NULL;
       }
       // Skip '_foobar' and '{\u00}*_options' and 'N'.
       if (preg_match('/[a-zA-Z]/', $key{0}) && $key !== 'N') {
index 87190c69d2001b7bcd2744d7204d29f43ecc53b3..bdb892ed4d9e13f2adbac689cdfc61a1bf63a28d 100644 (file)
@@ -389,7 +389,6 @@ class CRM_Utils_SQL_Select extends CRM_Utils_SQL_BaseParamQuery {
     return $this->insertInto($table, $fields);
   }
 
-
   /**
    * @param array $fields
    *   The fields to fill in the other table (in order).
index 1cf5d81f7879761b19f7e69ac3599599b98119b6..5433b17c416b14be12196782cd561306d6efb6a9 100644 (file)
@@ -70,7 +70,8 @@ class CRM_Utils_SQL_TempTable {
   const UTF8 = 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci';
   const CATEGORY_LENGTH = 12;
   const CATEGORY_REGEXP = ';^[a-zA-Z0-9]+$;';
-  const ID_LENGTH = 37; // MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
+  // MAX{64} - CATEGORY_LENGTH{12} - CONST_LENGHTH{15} = 37
+  const ID_LENGTH = 37;
   const ID_REGEXP = ';^[a-zA-Z0-9_]+$;';
   const INNODB = 'ENGINE=InnoDB';
   const MEMORY = 'ENGINE=MEMORY';
@@ -78,7 +79,12 @@ class CRM_Utils_SQL_TempTable {
   /**
    * @var bool
    */
-  protected $durable, $utf8;
+  protected $durable;
+
+  /**
+   * @var bool
+   */
+  protected $utf8;
 
   protected $category;
 
index 6e906392aaf6377579ecc2be2acea4829033b1f9..6323b8931d7d7db0979f10475ea568e50346fb92 100644 (file)
@@ -64,10 +64,12 @@ class CRM_Utils_Signer {
    *   Array, fields which should be part of the signature.
    */
   public function __construct($secret, $paramNames) {
-    sort($paramNames); // ensure consistent serialization of payloads
+    // ensure consistent serialization of payloads
+    sort($paramNames);
     $this->secret = $secret;
     $this->paramNames = $paramNames;
-    $this->signDelim = "_"; // chosen to be valid in URLs but not in salt or md5
+    // chosen to be valid in URLs but not in salt or md5
+    $this->signDelim = "_";
     $this->defaultSalt = CRM_Utils_String::createRandom(self::SALT_LEN, CRM_Utils_String::ALPHANUMERIC);
   }
 
index 104436ceee43ecf5292d9dde0f5a51c3b65ca91a..395cd549ebd9740dd82079cad8c730a17ae02e95 100644 (file)
@@ -35,11 +35,13 @@ class CRM_Utils_SoapServer {
 
   /**
    * Number of seconds we should let a soap process idle
+   * @var int
    */
-  static $soap_timeout = 0;
+  public static $soap_timeout = 0;
 
   /**
    * Cache the actual UF Class
+   * @var string
    */
   public $ufClass;
 
index d01dd52a000ccbd6d0149966227917800ad7f63e..c740e72a1f3849556d2c6dcf4532d6364947b7dc 100644 (file)
@@ -625,7 +625,6 @@ class CRM_Utils_String {
     return str_replace($search, $replace, $string);
   }
 
-
   /**
    * Use HTMLPurifier to clean up a text string and remove any potential
    * xss attacks. This is primarily used in public facing pages which
index 64c035bde618824d1c9853e2f52e0a09d5246953..1ac8d03d0be294cc14ffbf11bf05597ab8051e4e 100644 (file)
  */
 class CRM_Utils_System {
 
-  static $_callbacks = NULL;
+  public static $_callbacks = NULL;
 
   /**
    * @var string
    *   Page title
    */
-  static $title = '';
+  public static $title = '';
 
   /**
    * Access methods in the appropriate CMS class
@@ -103,8 +103,7 @@ class CRM_Utils_System {
       }
     }
 
-    return
-      self::url(
+    return self::url(
         $path,
         CRM_Utils_System::getLinksUrl($urlVar, $includeReset, $includeForce),
         $absolute
@@ -688,7 +687,6 @@ class CRM_Utils_System {
     return $config->userSystem->setMessage($message);
   }
 
-
   /**
    * Determine whether a value is null-ish.
    *
@@ -1168,8 +1166,7 @@ class CRM_Utils_System {
    * this function, please go and change the code in the install script as well.
    */
   public static function isSSL() {
-    return
-      (isset($_SERVER['HTTPS']) &&
+    return (isset($_SERVER['HTTPS']) &&
         !empty($_SERVER['HTTPS']) &&
         strtolower($_SERVER['HTTPS']) != 'off') ? TRUE : FALSE;
   }
index 3f99ae6af942548dc075e029f8d8481a44c338cf..bf6830d8e49f4c77c7a18e7e675adcc3afec0e20 100644 (file)
@@ -11,44 +11,44 @@ abstract class CRM_Utils_System_Base {
    * The correct method is to have functions on the UF classes for all UF specific
    * functions and leave the codebase oblivious to the type of CMS
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is Drupal.
    */
-  var $is_drupal = FALSE;
+  public $is_drupal = FALSE;
 
   /**
    * Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific
    * functions and leave the codebase oblivious to the type of CMS
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is Joomla!.
    */
-  var $is_joomla = FALSE;
+  public $is_joomla = FALSE;
 
   /**
    * deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific
    * functions and leave the codebase oblivious to the type of CMS
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is WordPress.
    */
-  var $is_wordpress = FALSE;
+  public $is_wordpress = FALSE;
 
   /**
    * Does this CMS / UF support a CMS specific logging mechanism?
-   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    * @var bool
+   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    */
-  var $supports_UF_Logging = FALSE;
+  public $supports_UF_Logging = FALSE;
 
   /**
    * @var bool
    *   TRUE, if the CMS allows CMS forms to be extended by hooks.
    */
-  var $supports_form_extensions = FALSE;
+  public $supports_form_extensions = FALSE;
 
   public function initialize() {
     if (\CRM_Utils_System::isSSL()) {
@@ -56,7 +56,7 @@ abstract class CRM_Utils_System_Base {
     }
   }
 
-  public abstract function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL);
+  abstract public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL);
 
   /**
    * Append an additional breadcrumb tag to the existing breadcrumb.
@@ -424,7 +424,7 @@ abstract class CRM_Utils_System_Base {
    * @return string
    *   loginURL for the current CMS
    */
-  public abstract function getLoginURL($destination = '');
+  abstract public function getLoginURL($destination = '');
 
   /**
    * Get the login destination string.
@@ -710,7 +710,6 @@ abstract class CRM_Utils_System_Base {
     }
   }
 
-
   /**
    * Get timezone from CMS.
    *
index e9061b5698ad7642ec5d7ffd02dcc48e1808bb8d..75d04ca71252e942cccc759c2bedf7522b2bc964 100644 (file)
@@ -40,10 +40,10 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
 
   /**
    * Does this CMS / UF support a CMS specific logging mechanism?
-   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    * @var bool
+   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    */
-  var $supports_UF_Logging = TRUE;
+  public $supports_UF_Logging = TRUE;
 
   /**
    */
@@ -266,10 +266,10 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
   public function getUserRecordUrl($contactID) {
     $uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
     if (CRM_Core_Session::singleton()
-        ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm([
-          'cms:administer users',
-          'cms:view user account',
-        ])
+      ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm([
+        'cms:administer users',
+        'cms:view user account',
+      ])
     ) {
       return $this->url('user/' . $uid);
     };
index 827493037b783da5595be64b99e77c3b866215d4..f98c794adfeb67ba1da04d1f9d80a16366fc2eb0 100644 (file)
@@ -35,6 +35,7 @@
  * Joomla specific stuff goes here.
  */
 class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
+
   /**
    * Class constructor.
    */
@@ -317,8 +318,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     global $database;
     $query = $db->getQuery(TRUE);
     $query->select($db->quoteName('email'))
-          ->from($db->quoteName('#__users'))
-          ->where($db->quoteName('id') . ' = ' . $user->id);
+      ->from($db->quoteName('#__users'))
+      ->where($db->quoteName('id') . ' = ' . $user->id);
     $database->setQuery($query);
     $user->email = $database->loadResult();
   }
index 468584843462a6bb0fcc9ca878e2141def813fc3..2edca70da7be9e91fb88e68a33a34f2bdbc46fd5 100644 (file)
@@ -38,9 +38,10 @@ class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
 
   /**
    * UF container variables.
+   * @var string
    */
-  static $uf = NULL;
-  static $ufClass = NULL;
+  public static $uf = NULL;
+  public static $ufClass = NULL;
 
   /**
    * Given a permission string, check for access requirements
index b1344e67231b50097bd4cd996c2aa3c89f7f8ef9..4882bbdb760ee8cc26d6a29e07585d31bb448731 100644 (file)
@@ -37,6 +37,7 @@
  * Helper authentication class for unit tests
  */
 class CRM_Utils_System_UnitTests extends CRM_Utils_System_Base {
+
   /**
    */
   public function __construct() {
index 5449099855055d0e71f48e34b3775f596b52dc8d..a188cff50138da129756af4b7224843a06893aa3 100644 (file)
@@ -37,6 +37,7 @@
  * WordPress specific stuff goes here
  */
 class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
+
   /**
    */
   public function __construct() {
@@ -460,6 +461,9 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
    *   Optional credentials
    *   - name: string, cms username
    *   - pass: string, cms password
+   * @param bool $loadUser
+   * @param bool $throwError
+   * @param mixed $realPath
    *
    * @return bool
    */
@@ -788,7 +792,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
   public function getUserRecordUrl($contactID) {
     $uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
     if (CRM_Core_Session::singleton()
-        ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(['cms:administer users'])
+      ->get('userID') == $contactID || CRM_Core_Permission::checkAnyPerm(['cms:administer users'])
     ) {
       return CRM_Core_Config::singleton()->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid;
     }
index aed05188468380b168630815d3dbe10d41b26584..64105889414032cccc0541d1c39ca96f25679800 100644 (file)
@@ -31,6 +31,7 @@
  * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\LoggerInterface {
+
   /**
    * Logs with an arbitrary level.
    *
index 89d67e0c5b9a4108f7553037e4f8c3b80a015552..d9014d7760ae41dbade150bf5ea5765e11222ba5 100644 (file)
@@ -35,9 +35,9 @@
  * Class to abstract token replacement.
  */
 class CRM_Utils_Token {
-  static $_requiredTokens = NULL;
+  public static $_requiredTokens = NULL;
 
-  static $_tokens = [
+  public static $_tokens = [
     'action' => [
       'forward',
       'optOut',
@@ -88,7 +88,6 @@ class CRM_Utils_Token {
     'welcome' => ['group'],
   ];
 
-
   /**
    * @deprecated
    *   This is used by CiviMail but will be made redundant by FlexMailer.
@@ -116,7 +115,7 @@ class CRM_Utils_Token {
    *   The message.
    *
    * @return bool|array
-   *    true if all required tokens are found,
+   *   true if all required tokens are found,
    *    else an array of the missing tokens
    */
   public static function requiredTokens(&$str) {
@@ -178,7 +177,7 @@ class CRM_Utils_Token {
    *   The token variable.
    * @param string $value
    *   The value to substitute for the token.
-   * @param string (reference) $str The string to replace in
+   * @param string $str (reference) The string to replace in
    *
    * @param bool $escapeSmarty
    *
@@ -1260,10 +1259,10 @@ class CRM_Utils_Token {
 
         // special case for greeting replacement
         foreach ([
-                   'email_greeting',
-                   'postal_greeting',
-                   'addressee',
-                 ] as $val) {
+          'email_greeting',
+          'postal_greeting',
+          'addressee',
+        ] as $val) {
           if (!empty($contactDetails[$contactID][$val])) {
             $contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
           }
@@ -1300,8 +1299,8 @@ class CRM_Utils_Token {
    *   contactDetails with hooks swapped out
    */
   public static function getAnonymousTokenDetails($contactIDs = [
-      0,
-    ],
+    0,
+  ],
                                            $returnProperties = NULL,
                                            $skipOnHold = TRUE,
                                            $skipDeceased = TRUE,
@@ -1432,6 +1431,7 @@ class CRM_Utils_Token {
    *
    * @param string $tokenString
    * @param array $contactDetails
+   * @param array $greetingTokens
    */
   private static function removeNullContactTokens(&$tokenString, $contactDetails, &$greetingTokens) {
     $greetingTokensOriginal = $greetingTokens;
@@ -1477,10 +1477,10 @@ class CRM_Utils_Token {
     $flattenTokens = [];
 
     foreach ([
-               'html',
-               'text',
-               'subject',
-             ] as $prop) {
+      'html',
+      'text',
+      'subject',
+    ] as $prop) {
       if (!isset($tokens[$prop])) {
         continue;
       }
@@ -1676,7 +1676,8 @@ class CRM_Utils_Token {
   public static function replaceContributionTokens($str, &$contribution, $html = FALSE, $knownTokens = NULL, $escapeSmarty = FALSE) {
     $key = 'contribution';
     if (!$knownTokens || !CRM_Utils_Array::value($key, $knownTokens)) {
-      return $str; //early return
+      //early return
+      return $str;
     }
     self::_buildContributionTokens();
 
@@ -1759,9 +1760,9 @@ class CRM_Utils_Token {
       case 'fee':
         try {
           $value = civicrm_api3('membership_type', 'getvalue', [
-              'id' => $membership['membership_type_id'],
-              'return' => 'minimum_fee',
-            ]);
+            'id' => $membership['membership_type_id'],
+            'return' => 'minimum_fee',
+          ]);
           $value = CRM_Utils_Money::format($value, NULL, NULL, TRUE);
         }
         catch (CiviCRM_API3_Exception $e) {
@@ -1847,7 +1848,7 @@ class CRM_Utils_Token {
    * @param string $entity
    * @param bool $usedForTokenWidget
    *
-   * @return array $customTokens
+   * @return array
    *   return custom field tokens in array('custom_N' => 'label') format
    */
   public static function getCustomFieldTokens($entity, $usedForTokenWidget = FALSE) {
index 314df438d66204f47a1d489a93162616878bc7ba..4396263aacef6319819ebe2e900c6cf79beacc13 100644 (file)
@@ -35,7 +35,7 @@ class CRM_Utils_Url {
    *
    * @param string $url
    *
-   * @return UriInterface
+   * @return \GuzzleHttp\Psr7\UriInterface
    */
   public static function parseUrl($url) {
     return new Uri($url);
@@ -44,7 +44,7 @@ class CRM_Utils_Url {
   /**
    * Unparse url back to a string.
    *
-   * @param UriInterface $parsed
+   * @param \GuzzleHttp\Psr7\UriInterface $parsed
    *
    * @return string
    */
index 87600a04ef63b3661f9b0bed9a898f892c6c504e..a9d5140c3cdd7f0c216c144f801377d845137cfe 100644 (file)
  * @copyright CiviCRM LLC (c) 2004-2019
  */
 class CRM_Utils_Verp {
-  /* Mapping of reserved characters to hex codes */
-
-  static $encodeMap = [
+  /**
+   * Mapping of reserved characters to hex codes
+   * @var array
+   */
+  public static $encodeMap = [
     '+' => '2B',
     '@' => '40',
     ':' => '3A',
@@ -46,9 +48,11 @@ class CRM_Utils_Verp {
     ']' => '5D',
   ];
 
-  /* Mapping of hex codes to reserved characters */
-
-  static $decodeMap = [
+  /**
+   * Mapping of hex codes to reserved characters
+   * @var array
+   */
+  public static $decodeMap = [
     '40' => '@',
     '3A' => ':',
     '25' => '%',
index 5fcc2a8162d8d5ca92026acaebd008d0a5eaf931..3e4add68b7cf54cfe1be34b3ffc72080118797da 100644 (file)
@@ -35,8 +35,9 @@ class CRM_Utils_Weight {
    * To reduce the size of this patch, we only sign the exploitable fields
    * which make up "$baseURL" in addOrder() (eg 'filter' or 'dao').
    * Less-exploitable fields (eg 'dir') are left unsigned.
+   * 'id','src','dst','dir'
    */
-  static $SIGNABLE_FIELDS = ['reset', 'dao', 'idName', 'url', 'filter']; // 'id','src','dst','dir'
+  public static $SIGNABLE_FIELDS = ['reset', 'dao', 'idName', 'url', 'filter'];
 
   /**
    * Correct duplicate weight entries by putting them (duplicate weights) in sequence.
index 7d17e1028aa80a17c7a76f4cec8840ed20d10290..df9b8a8f32f808a876999d3649acff3004d3e6f9 100644 (file)
@@ -41,6 +41,7 @@ class CRM_Utils_Wrapper {
    * Simple Controller.
    *
    * The controller which will handle the display and processing of this page.
+   * @var \CRM_Core_Controller_Simple object
    */
   protected $_controller;
 
index 7eaa32040e29f7c418969562d0814eea7f45cf72..daaf0a6772599eaecfc995132f72e7dc51db323d 100644 (file)
@@ -40,8 +40,10 @@ class CRM_Utils_XML {
    *   (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
    */
   public static function parseFile($file) {
-    $xml = FALSE; // SimpleXMLElement
-    $error = FALSE; // string
+    // SimpleXMLElement
+    $xml = FALSE;
+    // string
+    $error = FALSE;
 
     if (!file_exists($file)) {
       $error = 'File ' . $file . ' does not exist.';
@@ -72,8 +74,10 @@ class CRM_Utils_XML {
    *   (0 => SimpleXMLElement|FALSE, 1 => errorMessage|FALSE)
    */
   public static function parseString($string) {
-    $xml = FALSE; // SimpleXMLElement
-    $error = FALSE; // string
+    // SimpleXMLElement
+    $xml = FALSE;
+    // string
+    $error = FALSE;
 
     $oldLibXMLErrors = libxml_use_internal_errors();
     libxml_use_internal_errors(TRUE);
index b0cb93835ac0d41b1164d4013fb12e056e47abd9..2ef4c7915d0081731d12e4161222c1d11c3618f1 100644 (file)
@@ -44,7 +44,7 @@ class CRM_Utils_Zip {
    * @return mixed
    *   FALSE if #root level items !=1; otherwise, the name of base dir
    */
-  static public function findBaseDirName(ZipArchive $zip) {
+  public static function findBaseDirName(ZipArchive $zip) {
     $cnt = $zip->numFiles;
 
     $base = FALSE;
@@ -77,7 +77,7 @@ class CRM_Utils_Zip {
    * @return array(string)
    *   no trailing /
    */
-  static public function findBaseDirs(ZipArchive $zip) {
+  public static function findBaseDirs(ZipArchive $zip) {
     $cnt = $zip->numFiles;
     $basedirs = [];
 
@@ -101,7 +101,7 @@ class CRM_Utils_Zip {
    * @return string|bool
    *   Return string or FALSE
    */
-  static public function guessBasedir(ZipArchive $zip, $expected) {
+  public static function guessBasedir(ZipArchive $zip, $expected) {
     $candidate = FALSE;
     $basedirs = CRM_Utils_Zip::findBaseDirs($zip);
     if (in_array($expected, $basedirs)) {
@@ -118,7 +118,6 @@ class CRM_Utils_Zip {
     }
   }
 
-
   /**
    * An inefficient helper for creating a ZIP file from data in memory.
    * This is only intended for building temp files for unit-testing.
@@ -131,7 +130,7 @@ class CRM_Utils_Zip {
    *   Array, keys are file names and values are file contents.
    * @return bool
    */
-  static public function createTestZip($zipName, $dirs, $files) {
+  public static function createTestZip($zipName, $dirs, $files) {
     $zip = new ZipArchive();
     $res = $zip->open($zipName, ZipArchive::CREATE);
     if ($res === TRUE) {