From 6714d8d227f25c94a3435acf445ef902c36b880c Mon Sep 17 00:00:00 2001
From: Seamus Lee ' . 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',
- ]) . ' ' . ts('The mail library returned the following error message:') . ' ' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '
\n" . ts("Following is the list of contacts whose address is not parsed:") . "
\n";
foreach ($unparseableContactAddress as $contactLink) {
diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php
index b95b9c4be3..4cda076ea3 100644
--- a/CRM/Utils/Array.php
+++ b/CRM/Utils/Array.php
@@ -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)
)
)
) {
diff --git a/CRM/Utils/Cache.php b/CRM/Utils/Cache.php
index ee4ac03f36..23975cae4d 100644
--- a/CRM/Utils/Cache.php
+++ b/CRM/Utils/Cache.php
@@ -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
diff --git a/CRM/Utils/Cache/APCcache.php b/CRM/Utils/Cache/APCcache.php
index e18c06121f..187da7edb8 100644
--- a/CRM/Utils/Cache/APCcache.php
+++ b/CRM/Utils/Cache/APCcache.php
@@ -32,8 +32,10 @@
*/
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'];
diff --git a/CRM/Utils/Cache/ArrayCache.php b/CRM/Utils/Cache/ArrayCache.php
index 47475326f3..92badc0cda 100644
--- a/CRM/Utils/Cache/ArrayCache.php
+++ b/CRM/Utils/Cache/ArrayCache.php
@@ -37,12 +37,14 @@
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;
diff --git a/CRM/Utils/Cache/ArrayDecorator.php b/CRM/Utils/Cache/ArrayDecorator.php
index c9007070c3..86ac79728a 100644
--- a/CRM/Utils/Cache/ArrayDecorator.php
+++ b/CRM/Utils/Cache/ArrayDecorator.php
@@ -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
diff --git a/CRM/Utils/Cache/FastArrayDecorator.php b/CRM/Utils/Cache/FastArrayDecorator.php
index 82ef578d72..d0eb1d2a9e 100644
--- a/CRM/Utils/Cache/FastArrayDecorator.php
+++ b/CRM/Utils/Cache/FastArrayDecorator.php
@@ -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
diff --git a/CRM/Utils/Cache/Memcache.php b/CRM/Utils/Cache/Memcache.php
index 3e8057c49d..511663792e 100644
--- a/CRM/Utils/Cache/Memcache.php
+++ b/CRM/Utils/Cache/Memcache.php
@@ -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,
diff --git a/CRM/Utils/Cache/Memcached.php b/CRM/Utils/Cache/Memcached.php
index eeed41cc14..fd3aee39c2 100644
--- a/CRM/Utils/Cache/Memcached.php
+++ b/CRM/Utils/Cache/Memcached.php
@@ -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,
diff --git a/CRM/Utils/Cache/NaiveMultipleTrait.php b/CRM/Utils/Cache/NaiveMultipleTrait.php
index 16916f2a71..14914d964b 100644
--- a/CRM/Utils/Cache/NaiveMultipleTrait.php
+++ b/CRM/Utils/Cache/NaiveMultipleTrait.php
@@ -109,6 +109,7 @@ trait CRM_Utils_Cache_NaiveMultipleTrait {
}
/**
+ * @param $func
* @param $keys
* @throws \CRM_Utils_Cache_InvalidArgumentException
*/
diff --git a/CRM/Utils/Cache/NoCache.php b/CRM/Utils/Cache/NoCache.php
index 9d39503782..42921bd7c8 100644
--- a/CRM/Utils/Cache/NoCache.php
+++ b/CRM/Utils/Cache/NoCache.php
@@ -32,8 +32,10 @@
*/
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
diff --git a/CRM/Utils/Cache/Redis.php b/CRM/Utils/Cache/Redis.php
index 1b64e42881..f7c8435f79 100644
--- a/CRM/Utils/Cache/Redis.php
+++ b/CRM/Utils/Cache/Redis.php
@@ -34,8 +34,10 @@
*/
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
diff --git a/CRM/Utils/Cache/SerializeCache.php b/CRM/Utils/Cache/SerializeCache.php
index 3b1cf9517e..f17b459107 100644
--- a/CRM/Utils/Cache/SerializeCache.php
+++ b/CRM/Utils/Cache/SerializeCache.php
@@ -37,10 +37,12 @@
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), "version, '<')) {
$updates[] = ts('%1 (%2) version %3 is installed. Upgrade to version %5.', [
- 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.
*
diff --git a/CRM/Utils/Check/Component/PriceFields.php b/CRM/Utils/Check/Component/PriceFields.php
index 47e325cfe0..4261c95a8d 100644
--- a/CRM/Utils/Check/Component/PriceFields.php
+++ b/CRM/Utils/Check/Component/PriceFields.php
@@ -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 .= " ";
}
if ($count > 0) {
diff --git a/CRM/Utils/Check/Component/Security.php b/CRM/Utils/Check/Component/Security.php
index 984bf5fc3a..c0291e50d9 100644
--- a/CRM/Utils/Check/Component/Security.php
+++ b/CRM/Utils/Check/Component/Security.php
@@ -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.
diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php
index 913c930a45..24b2f73880 100644
--- a/CRM/Utils/Date.php
+++ b/CRM/Utils/Date.php
@@ -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.
*
diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php
index e05a690cd8..9d2d7ca4e0 100644
--- a/CRM/Utils/DeprecatedUtils.php
+++ b/CRM/Utils/DeprecatedUtils.php
@@ -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
*
diff --git a/CRM/Utils/FakeObject.php b/CRM/Utils/FakeObject.php
index d119548e3c..83823708f8 100644
--- a/CRM/Utils/FakeObject.php
+++ b/CRM/Utils/FakeObject.php
@@ -43,6 +43,7 @@
* @endcode
*/
class CRM_Utils_FakeObject {
+
/**
* @param $array
*/
diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php
index d9040ffc0f..b51905f714 100644
--- a/CRM/Utils/File.php
+++ b/CRM/Utils/File.php
@@ -797,7 +797,8 @@ HTACCESS;
}
}
if (empty($childParts)) {
- return FALSE; // same directory
+ // same directory
+ return FALSE;
}
else {
return TRUE;
diff --git a/CRM/Utils/GlobalStack.php b/CRM/Utils/GlobalStack.php
index 50bf3c268a..0884e3b134 100644
--- a/CRM/Utils/GlobalStack.php
+++ b/CRM/Utils/GlobalStack.php
@@ -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();
}
diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php
index c4c8cd0ae9..8282a89c7c 100644
--- a/CRM/Utils/Hook.php
+++ b/CRM/Utils/Hook.php
@@ -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 $dao->ps_title $dao->psf_label View Price Set Fields
' . $result->getMessage() . '
' . ts('The mail library returned the following error message:') . '
' . $result->getMessage() . '
' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '
'; if (is_a($mailer, 'Mail_smtp')) { $message .= '' . ts('Check this page for more information.', [ - 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE), - ]) . '
'; + 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE), + ]) . ''; return $message; } diff --git a/CRM/Utils/Migrate/Export.php b/CRM/Utils/Migrate/Export.php index c6b372fc15..7497fb962a 100644 --- a/CRM/Utils/Migrate/Export.php +++ b/CRM/Utils/Migrate/Export.php @@ -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'; } diff --git a/CRM/Utils/Migrate/ExportJSON.php b/CRM/Utils/Migrate/ExportJSON.php index b9adff7887..ffaa63065b 100644 --- a/CRM/Utils/Migrate/ExportJSON.php +++ b/CRM/Utils/Migrate/ExportJSON.php @@ -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 ); } diff --git a/CRM/Utils/Migrate/Import.php b/CRM/Utils/Migrate/Import.php index 0a25d24bc7..340e10d51a 100644 --- a/CRM/Utils/Migrate/Import.php +++ b/CRM/Utils/Migrate/Import.php @@ -31,6 +31,7 @@ * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Utils_Migrate_Import { + /** * Class constructor. */ diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index 77606d7061..ce15b9995b 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -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) { diff --git a/CRM/Utils/Network.php b/CRM/Utils/Network.php index 0564590867..0a256816b0 100644 --- a/CRM/Utils/Network.php +++ b/CRM/Utils/Network.php @@ -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. * diff --git a/CRM/Utils/Number.php b/CRM/Utils/Number.php index 619c8118d3..02e31ad96a 100644 --- a/CRM/Utils/Number.php +++ b/CRM/Utils/Number.php @@ -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; diff --git a/CRM/Utils/OpenFlashChart.php b/CRM/Utils/OpenFlashChart.php index 9f0b8f2db4..26e34292eb 100644 --- a/CRM/Utils/OpenFlashChart.php +++ b/CRM/Utils/OpenFlashChart.php @@ -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]; } diff --git a/CRM/Utils/PDF/Document.php b/CRM/Utils/PDF/Document.php index 2fa43b4a43..25490c9bb0 100644 --- a/CRM/Utils/PDF/Document.php +++ b/CRM/Utils/PDF/Document.php @@ -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()); diff --git a/CRM/Utils/PDF/Label.php b/CRM/Utils/PDF/Label.php index df5f935fb9..1dc7caad17 100644 --- a/CRM/Utils/PDF/Label.php +++ b/CRM/Utils/PDF/Label.php @@ -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; /** diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 72c0d6c5bf..7694dc24c7 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -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]]; diff --git a/CRM/Utils/Pager.php b/CRM/Utils/Pager.php index 74f8afee2d..390764d766 100644 --- a/CRM/Utils/Pager.php +++ b/CRM/Utils/Pager.php @@ -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 => '', - 2 => $this->_response['numPages'], - ]); + 1 => '', + 2 => $this->_response['numPages'], + ]); $this->_response['titleBottom'] = ts('Page %1 of %2', [ - 1 => '', - 2 => $this->_response['numPages'], - ]); + 1 => '', + 2 => $this->_response['numPages'], + ]); } /** diff --git a/CRM/Utils/PseudoConstant.php b/CRM/Utils/PseudoConstant.php index 4ccbdba0de..7a3cf0d547 100644 --- a/CRM/Utils/PseudoConstant.php +++ b/CRM/Utils/PseudoConstant.php @@ -36,6 +36,7 @@ class CRM_Utils_PseudoConstant { /** * CiviCRM pseudoconstant classes for wrapper functions. + * @var array */ private static $constantClasses = [ 'CRM_Core_PseudoConstant', diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index 863226ea15..9c4b49ee59 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -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) { diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 52e7e52964..b1df33aee1 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -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'); diff --git a/CRM/Utils/ReCAPTCHA.php b/CRM/Utils/ReCAPTCHA.php index d1afe457a1..3198043014 100644 --- a/CRM/Utils/ReCAPTCHA.php +++ b/CRM/Utils/ReCAPTCHA.php @@ -62,7 +62,6 @@ class CRM_Utils_ReCAPTCHA { return self::$_singleton; } - /** * Check if reCaptcha settings is avilable to add on form. */ diff --git a/CRM/Utils/Request.php b/CRM/Utils/Request.php index a435d65a7c..2f55cea32c 100644 --- a/CRM/Utils/Request.php +++ b/CRM/Utils/Request.php @@ -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) { diff --git a/CRM/Utils/SQL/BaseParamQuery.php b/CRM/Utils/SQL/BaseParamQuery.php index c2a61422b3..f48d05556c 100644 --- a/CRM/Utils/SQL/BaseParamQuery.php +++ b/CRM/Utils/SQL/BaseParamQuery.php @@ -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; /** diff --git a/CRM/Utils/SQL/Insert.php b/CRM/Utils/SQL/Insert.php index c06bd601c1..816c89f605 100644 --- a/CRM/Utils/SQL/Insert.php +++ b/CRM/Utils/SQL/Insert.php @@ -36,6 +36,7 @@ class CRM_Utils_SQL_Insert { /** * Array