From 627456b56a8eff5d0d6ed63c7e7f8a54e76e004e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 24 May 2014 15:26:43 +1200 Subject: [PATCH] add a few remaining missing comment blocks (autogenerated) --- CRM/Campaign/Page/DashBoard.php | 3 + distmaker/utils/joomlaxml.php | 3 + install/civicrm.php | 23 +++ install/index.php | 165 ++++++++++++++++++ sql/GenerateData.php | 50 ++++++ sql/GenerateMailing.php | 3 + sql/GenerateReportData.php | 92 ++++++++++ .../main.php | 3 + tests/phpunit/CiviTest/AuthorizeNet.php | 4 + xml/plugins/block.ts.php | 7 + 10 files changed, 353 insertions(+) diff --git a/CRM/Campaign/Page/DashBoard.php b/CRM/Campaign/Page/DashBoard.php index b2dd8e1cee..c125c53d55 100644 --- a/CRM/Campaign/Page/DashBoard.php +++ b/CRM/Campaign/Page/DashBoard.php @@ -169,6 +169,9 @@ class CRM_Campaign_Page_DashBoard extends CRM_Core_Page { return self::$_petitionActionLinks; } + /** + * @return mixed + */ function browseCampaign() { // ensure valid javascript (these must have a value set) $this->assign('searchParams', json_encode(NULL)); diff --git a/distmaker/utils/joomlaxml.php b/distmaker/utils/joomlaxml.php index 9bbf93fa05..647f984f5a 100644 --- a/distmaker/utils/joomlaxml.php +++ b/distmaker/utils/joomlaxml.php @@ -53,6 +53,9 @@ function createDir($dir, $perm = 0755) { } } +/** + * @param $version + */ function generateJoomlaConfig($version) { global $targetDir, $sourceCheckoutDir, $pkgType; diff --git a/install/civicrm.php b/install/civicrm.php index 11b8931934..dd189db3b1 100644 --- a/install/civicrm.php +++ b/install/civicrm.php @@ -56,6 +56,10 @@ function civicrm_setup($filesDirectory) { $compileDir = addslashes($compileDir); } +/** + * @param $name + * @param $buffer + */ function civicrm_write_file($name, &$buffer) { $fd = fopen($name, "w"); if (!$fd) { @@ -65,6 +69,9 @@ function civicrm_write_file($name, &$buffer) { fclose($fd); } +/** + * @param $config + */ function civicrm_main(&$config) { global $sqlPath, $crmPath, $cmsPath, $installType; @@ -115,6 +122,11 @@ function civicrm_main(&$config) { } +/** + * @param $dsn + * @param $fileName + * @param bool $lineMode + */ function civicrm_source($dsn, $fileName, $lineMode = FALSE) { global $crmPath; require_once "$crmPath/packages/DB.php"; @@ -167,6 +179,11 @@ function civicrm_source($dsn, $fileName, $lineMode = FALSE) { } } +/** + * @param $config + * + * @return string + */ function civicrm_config(&$config) { global $crmPath, $comPath; global $compileDir; @@ -219,6 +236,9 @@ function civicrm_config(&$config) { return trim($str); } +/** + * @return string + */ function civicrm_cms_base() { global $installType; @@ -269,6 +289,9 @@ function civicrm_cms_base() { return $url . $baseURL; } +/** + * @return string + */ function civicrm_home_url() { $drupalURL = civicrm_cms_base(); return $drupalURL . 'index.php?q=civicrm'; diff --git a/install/index.php b/install/index.php index 93d6d7d0eb..174a0a5c09 100644 --- a/install/index.php +++ b/install/index.php @@ -533,6 +533,11 @@ class InstallRequirements { return $this->errors; } + /** + * @param $min + * @param $recommended + * @param $testDetails + */ function requireMemory($min, $recommended, $testDetails) { $this->testing($testDetails); $mem = $this->getPHPMemory(); @@ -551,6 +556,9 @@ class InstallRequirements { } } + /** + * @return float + */ function getPHPMemory() { $memString = ini_get("memory_limit"); @@ -578,6 +586,9 @@ class InstallRequirements { } } + /** + * @param null $section + */ function showTable($section = NULL) { if ($section) { $tests = $this->tests[$section]; @@ -600,6 +611,12 @@ class InstallRequirements { } } + /** + * @param $funcName + * @param $testDetails + * + * @return bool + */ function requireFunction($funcName, $testDetails) { $this->testing($testDetails); @@ -612,6 +629,9 @@ class InstallRequirements { } } + /** + * @param $testDetails + */ function checkXCache($testDetails) { if (function_exists('xcache_isset') && ini_get('xcache.size') > 0 @@ -621,6 +641,11 @@ class InstallRequirements { } } + /** + * @param $minVersion + * @param $testDetails + * @param null $maxVersion + */ function requirePHPVersion($minVersion, $testDetails, $maxVersion = NULL) { $this->testing($testDetails); @@ -648,6 +673,11 @@ class InstallRequirements { $this->error($testDetails); } + /** + * @param $filename + * @param $testDetails + * @param bool $absolute + */ function requireFile($filename, $testDetails, $absolute = FALSE) { $this->testing($testDetails); if (!$absolute) { @@ -659,6 +689,9 @@ class InstallRequirements { } } + /** + * @param $testDetails + */ function requireNoPathSeparator($testDetails) { $this->testing($testDetails); if (substr_count($this->getBaseDir(), PATH_SEPARATOR)) { @@ -666,6 +699,10 @@ class InstallRequirements { } } + /** + * @param $filename + * @param $testDetails + */ function requireNoFile($filename, $testDetails) { $this->testing($testDetails); $filename = $this->getBaseDir() . $filename; @@ -675,6 +712,10 @@ class InstallRequirements { } } + /** + * @param $filename + * @param $testDetails + */ function moveFileOutOfTheWay($filename, $testDetails) { $this->testing($testDetails); $filename = $this->getBaseDir() . $filename; @@ -686,6 +727,11 @@ class InstallRequirements { } } + /** + * @param $filename + * @param $testDetails + * @param bool $absolute + */ function requireWriteable($filename, $testDetails, $absolute = FALSE) { $this->testing($testDetails); if (!$absolute) { @@ -707,6 +753,10 @@ class InstallRequirements { } } + /** + * @param $moduleName + * @param $testDetails + */ function requireApacheModule($moduleName, $testDetails) { $this->testing($testDetails); if (!in_array($moduleName, apache_get_modules())) { @@ -714,6 +764,12 @@ class InstallRequirements { } } + /** + * @param $server + * @param $username + * @param $password + * @param $testDetails + */ function requireMysqlConnection($server, $username, $password, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -727,6 +783,10 @@ class InstallRequirements { } } + /** + * @param $server + * @param $testDetails + */ function requireMySQLServer($server, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, NULL, NULL); @@ -740,6 +800,10 @@ class InstallRequirements { } } + /** + * @param $version + * @param $testDetails + */ function requireMySQLVersion($version, $testDetails) { $this->testing($testDetails); @@ -761,6 +825,13 @@ class InstallRequirements { } } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $testDetails + */ function requireMySQLInnoDB($server, $username, $password, $database, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -789,6 +860,13 @@ class InstallRequirements { } } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $testDetails + */ function requireMySQLTempTables($server, $username, $password, $database, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -812,6 +890,13 @@ class InstallRequirements { $result = mysql_query('DROP TEMPORARY TABLE civicrm_install_temp_table_test'); } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $testDetails + */ function requireMySQLTrigger($server, $username, $password, $database, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -846,6 +931,13 @@ class InstallRequirements { } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $testDetails + */ function requireMySQLLockTables($server, $username, $password, $database, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -888,6 +980,12 @@ class InstallRequirements { return; } + /** + * @param $server + * @param $username + * @param $password + * @param $testDetails + */ function requireMySQLAutoIncrementIncrementOne($server, $username, $password, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -914,6 +1012,14 @@ class InstallRequirements { } } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $minValueKB + * @param $testDetails + */ function requireMySQLThreadStack($server, $username, $password, $database, $minValueKB, $testDetails) { $this->testing($testDetails); $conn = @mysql_connect($server, $username, $password); @@ -942,6 +1048,14 @@ class InstallRequirements { } } + /** + * @param $server + * @param $username + * @param $password + * @param $database + * @param $testDetails + * @param bool $onlyRequire + */ function requireDatabaseOrCreatePermissions($server, $username, $password, @@ -978,6 +1092,10 @@ class InstallRequirements { } } + /** + * @param $varNames + * @param $errorMessage + */ function requireServerVariables($varNames, $errorMessage) { //$this->testing($testDetails); foreach ($varNames as $varName) { @@ -994,6 +1112,11 @@ class InstallRequirements { } } + /** + * @param $testDetails + * + * @return bool + */ function isRunningApache($testDetails) { $this->testing($testDetails); if (function_exists('apache_get_modules') || stristr($_SERVER['SERVER_SIGNATURE'], 'Apache')) { @@ -1004,10 +1127,16 @@ class InstallRequirements { return FALSE; } + /** + * @return string + */ function getBaseDir() { return dirname($_SERVER['SCRIPT_FILENAME']) . CIVICRM_DIRECTORY_SEPARATOR; } + /** + * @param $testDetails + */ function testing($testDetails) { if (!$testDetails) { return; @@ -1024,6 +1153,9 @@ class InstallRequirements { $this->tests[$section][$test] = array("good", $message); } + /** + * @param $testDetails + */ function error($testDetails) { $section = $testDetails[0]; $test = $testDetails[1]; @@ -1032,6 +1164,9 @@ class InstallRequirements { $this->errors[] = $testDetails; } + /** + * @param $testDetails + */ function warning($testDetails) { $section = $testDetails[0]; $test = $testDetails[1]; @@ -1041,16 +1176,31 @@ class InstallRequirements { $this->warnings[] = $testDetails; } + /** + * @return int + */ function hasErrors() { return sizeof($this->errors); } + /** + * @return int + */ function hasWarnings() { return sizeof($this->warnings); } } +/** + * Class Installer + */ class Installer extends InstallRequirements { + /** + * @param $server + * @param $username + * @param $password + * @param $database + */ function createDatabaseIfNotExists($server, $username, $password, $database) { $conn = @mysql_connect($server, $username, $password); @@ -1067,6 +1217,11 @@ class Installer extends InstallRequirements { } } + /** + * @param $config + * + * @return mixed + */ function install($config) { global $installDirPath; @@ -1281,6 +1436,12 @@ function civicrm_install_set_drupal_perms() { } } +/** + * @param $cmsPath + * @param $str + * + * @return string + */ function getSiteDir($cmsPath, $str) { static $siteDir = ''; @@ -1318,6 +1479,10 @@ function getSiteDir($cmsPath, $str) { return $siteDir; } +/** + * @param $errorTitle + * @param $errorMsg + */ function errorDisplayPage($errorTitle, $errorMsg) { include ('error.html'); exit(); diff --git a/sql/GenerateData.php b/sql/GenerateData.php index be420a2242..cc499fef6e 100644 --- a/sql/GenerateData.php +++ b/sql/GenerateData.php @@ -93,6 +93,10 @@ require_once '../civicrm.config.php'; // autoload require_once 'CRM/Core/ClassLoader.php'; CRM_Core_ClassLoader::singleton()->register(); + +/** + * Class CRM_GCD + */ class CRM_GCD { /** @@ -275,6 +279,9 @@ class CRM_GCD { return $string; } + /** + * @return string + */ private function randomChar() { return chr(mt_rand(65, 90)); } @@ -300,15 +307,30 @@ class CRM_GCD { return $items[mt_rand(0, count($items) - 1)]; } + /** + * @param $items + * + * @return mixed + */ private function randomIndex($items) { return $this->randomItem(array_keys($items)); } + /** + * @param $items + * + * @return array + */ private function randomKeyValue($items) { $key = $this->randomIndex($items); return array($key, $items[$key]); } + /** + * @param $chance + * + * @return int + */ private function probability($chance) { if (mt_rand(0, 100) < ($chance * 100)) { return 1; @@ -457,6 +479,9 @@ class CRM_GCD { } } + /** + * @return string + */ public function randomName() { $first_name = $this->randomItem(($this->probability(.5) ? 'fe' : '') . 'male_name'); $middle_name = ucfirst($this->randomChar()); @@ -1188,6 +1213,9 @@ class CRM_GCD { } } + /** + * @return array + */ function getZipCodeInfo() { if (!$this->stateMap) { @@ -1219,6 +1247,11 @@ class CRM_GCD { } } + /** + * @param $zipCode + * + * @return array + */ static function getLatLong($zipCode) { $query = "http://maps.google.com/maps?q=$zipCode&output=js"; $userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0"; @@ -1364,6 +1397,11 @@ VALUES $this->_query($activityContact); } + /** + * @param $date + * + * @return string + */ static function repairDate($date) { $dropArray = array('-' => '', ':' => '', ' ' => ''); return strtr($date, $dropArray); @@ -1805,6 +1843,10 @@ WHERE cefa.account_relationship = 1"; $this->addFinancialItem($result); } + /** + * @param $result + * @param null $financialAccountId + */ private function addFinancialItem($result, $financialAccountId = NULL) { $defaultFinancialAccount = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1"); while($result->fetch()){ @@ -1915,10 +1957,18 @@ AND a.details = 'Participant Payment' } } +/** + * @param null $str + * + * @return bool + */ function user_access($str = NULL) { return TRUE; } +/** + * @return array + */ function module_list() { return array(); } diff --git a/sql/GenerateMailing.php b/sql/GenerateMailing.php index 624e434485..12954d03bc 100644 --- a/sql/GenerateMailing.php +++ b/sql/GenerateMailing.php @@ -89,6 +89,9 @@ for ($i = 1; $i <= $numGroups; $i++) { $group->save(); } +/** + * @return string + */ function generateRandomDate() { $year = 2006 + mt_rand(0, 2); $month = 1 + mt_rand(0, 11); diff --git a/sql/GenerateReportData.php b/sql/GenerateReportData.php index 8c1be3e285..b7e83ccb0a 100644 --- a/sql/GenerateReportData.php +++ b/sql/GenerateReportData.php @@ -111,6 +111,10 @@ require_once 'CRM/Contact/DAO/Relationship.php'; require_once 'CRM/Event/DAO/Participant.php'; require_once 'CRM/Contribute/DAO/ContributionSoft.php'; require_once 'CRM/Member/DAO/MembershipPayment.php'; + +/** + * Class CRM_GCD + */ class CRM_GCD { /******************************************************* @@ -255,24 +259,43 @@ class CRM_GCD { return $string; } + /** + * @return string + */ private function _getRandomChar() { return chr(mt_rand(65, 90)); } + /** + * @return int + */ private function getRandomBoolean() { return mt_rand(0, 1); } + /** + * @param $array1 + * + * @return mixed + */ private function _getRandomElement(&$array1) { return $array1[mt_rand(1, count($array1)) - 1]; } + /** + * @param $array1 + * + * @return int + */ private function _getRandomIndex(&$array1) { return mt_rand(1, count($array1)); } // country state city combo + /** + * @return array + */ private function _getRandomCSC() { $array1 = array(); @@ -347,6 +370,9 @@ class CRM_GCD { // insert data into db's + /** + * @param $dao + */ private function _insert(&$dao) { if (self::ADD_TO_DB) { if (!$dao->insert()) { @@ -358,6 +384,9 @@ class CRM_GCD { } // update data into db's + /** + * @param $dao + */ private function _update($dao) { if (self::ADD_TO_DB) { if (!$dao->update()) { @@ -523,6 +552,11 @@ class CRM_GCD { } } + /** + * @param $id + * + * @return string + */ public function getContactType($id) { if (in_array($id, $this->individual)) { return 'Individual'; @@ -613,6 +647,9 @@ class CRM_GCD { } } + /** + * @return string + */ public function randomName() { $prefix = $this->_getRandomIndex($this->prefix); $first_name = ucfirst($this->_getRandomElement($this->firstName)); @@ -861,6 +898,12 @@ class CRM_GCD { } } + /** + * @param $locationTypeId + * @param $contactId + * @param bool $domain + * @param bool $isPrimary + */ private function _addLocation($locationTypeId, $contactId, $domain = FALSE, $isPrimary = TRUE) { $this->_addAddress($locationTypeId, $contactId, $isPrimary); @@ -882,6 +925,13 @@ class CRM_GCD { } } + /** + * @param $locationTypeId + * @param $contactId + * @param bool $isPrimary + * @param null $locationBlockID + * @param int $offset + */ private function _addAddress($locationTypeId, $contactId, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) { $addressDAO = new CRM_Core_DAO_Address(); @@ -910,11 +960,24 @@ class CRM_GCD { $this->_insert($addressDAO); } + /** + * @param $sortName + * + * @return mixed + */ private function _sortNameToEmail($sortName) { $email = preg_replace("([^a-zA-Z0-9_-]*)", "", $sortName); return $email; } + /** + * @param $locationTypeId + * @param $contactId + * @param $phoneType + * @param bool $isPrimary + * @param null $locationBlockID + * @param int $offset + */ private function _addPhone($locationTypeId, $contactId, $phoneType, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) { if ($contactId % 3) { $phone = new CRM_Core_DAO_Phone(); @@ -927,6 +990,14 @@ class CRM_GCD { } } + /** + * @param $locationTypeId + * @param $contactId + * @param $sortName + * @param bool $isPrimary + * @param null $locationBlockID + * @param int $offset + */ private function _addEmail($locationTypeId, $contactId, $sortName, $isPrimary = FALSE, $locationBlockID = NULL, $offset = 1) { if ($contactId % 2) { $email = new CRM_Core_DAO_Email(); @@ -1160,6 +1231,9 @@ class CRM_GCD { } } + /** + * @return array + */ static function getZipCodeInfo() { $stateID = mt_rand(1000, 5132); $offset = mt_rand(1, 4132); @@ -1174,6 +1248,11 @@ class CRM_GCD { return array(); } + /** + * @param $zipCode + * + * @return array + */ static function getLatLong($zipCode) { $query = "http://maps.google.com/maps?q=$zipCode&output=js"; $userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0"; @@ -1297,6 +1376,11 @@ VALUES CRM_Core_DAO::executeQuery($activity, CRM_Core_DAO::$_nullArray); } + /** + * @param $date + * + * @return string + */ static function repairDate($date) { $dropArray = array('-' => '', ':' => '', ' ' => ''); return strtr($date, $dropArray); @@ -1603,10 +1687,18 @@ VALUES } } +/** + * @param null $str + * + * @return bool + */ function user_access($str = NULL) { return TRUE; } +/** + * @return array + */ function module_list() { return array(); } diff --git a/tests/extensions/test.extension.manager.searchtest/main.php b/tests/extensions/test.extension.manager.searchtest/main.php index e7b7104ab1..dd6b15cd24 100644 --- a/tests/extensions/test.extension.manager.searchtest/main.php +++ b/tests/extensions/test.extension.manager.searchtest/main.php @@ -2,6 +2,9 @@ require_once 'CRM/Contact/Form/Search/Custom/Base.php'; class test_extension_manager_searchtest extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface { + /** + * @param $formValues + */ function __construct(&$formValues) { parent::__construct($formValues); } diff --git a/tests/phpunit/CiviTest/AuthorizeNet.php b/tests/phpunit/CiviTest/AuthorizeNet.php index 78217f0a0a..dc354b6e63 100644 --- a/tests/phpunit/CiviTest/AuthorizeNet.php +++ b/tests/phpunit/CiviTest/AuthorizeNet.php @@ -1,4 +1,8 @@