Commit 683bf891 authored by Seamus Lee's avatar Seamus Lee

(NFC) Lint additional php files up to the new coder standard

parent 33484eb2
......@@ -38,11 +38,11 @@ class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL {
/**
* @var string
*/
static $_entityTable = NULL;
static $_objectTable = NULL;
static $_operation = NULL;
public static $_entityTable = NULL;
public static $_objectTable = NULL;
public static $_operation = NULL;
static $_fieldKeys = NULL;
public static $_fieldKeys = NULL;
/**
* Get ACL entity table.
......
......@@ -36,7 +36,7 @@
*/
class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache {
static $_cache = NULL;
public static $_cache = NULL;
/**
* @param int $id
......
......@@ -35,7 +35,7 @@
* Access Control EntityRole.
*/
class CRM_ACL_BAO_EntityRole extends CRM_ACL_DAO_EntityRole {
static $_entityTable = NULL;
public static $_entityTable = NULL;
/**
* Get entity table.
......
......@@ -39,7 +39,7 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -37,7 +37,7 @@ class CRM_ACL_Page_ACLBasic extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -39,7 +39,7 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -41,7 +41,7 @@ class CRM_Badge_Page_Layout extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -462,8 +462,9 @@ AND ( p.is_active = 1 OR p.id IS NULL )
/**
* Retrieve the basic contact type associated with given subType.
*
* @param array /string $subType contact subType.
* @return array/string of basicTypes.
* @param array|string $subType contact subType.
* @return array|string
* basicTypes.
*/
public static function getBasicType($subType) {
static $_cache = NULL;
......@@ -664,7 +665,7 @@ WHERE name = %1";
else {
$name = self::getBasicType($contactName);
if (!$name) {
return;
return NULL;
}
$value = ['name' => "New $name"];
CRM_Core_BAO_Navigation::retrieve($value, $navinfo);
......@@ -891,6 +892,7 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
* Custom group id.
* @param array $subtypes
* List of subtypes related to which entry is to be removed.
* @param array $subtypesToPreserve
*
* @return bool
*/
......
......@@ -41,7 +41,7 @@ class CRM_Contribute_Page_Premium extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -11,7 +11,7 @@
*/
class CRM_Widget_Widget {
static $_methodTable;
public static $_methodTable;
public function initialize() {
if (!self::$_methodTable) {
......
......@@ -18,7 +18,7 @@ class Civi {
/**
* A central location for static variable storage.
*
* @var array
* @code
* `Civi::$statics[__CLASS__]['foo'] = 'bar';
* @endcode
......
......@@ -31,7 +31,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CiviContributeProcessor {
static $_paypalParamsMapper = array(
public static $_paypalParamsMapper = array(
//category => array(paypal_param => civicrm_field);
'contact' => array(
'salutation' => 'prefix_id',
......@@ -72,10 +72,13 @@ class CiviContributeProcessor {
),
);
static $_csvParamsMapper = array(
// Note: if csv header is not present in the mapper, header itself
// is considered as a civicrm field.
//category => array(csv_header => civicrm_field);
/**
* Note: if csv header is not present in the mapper, header itself
* is considered as a civicrm field.
* category => array(csv_header => civicrm_field);
* @var array
*/
public static $_csvParamsMapper = array(
'contact' => array(
'first_name' => 'first_name',
'last_name' => 'last_name',
......
......@@ -39,26 +39,35 @@
*/
class civicrm_cli {
// required values that must be passed
// via the command line
var $_required_arguments = array('action', 'entity');
var $_additional_arguments = array();
var $_entity = NULL;
var $_action = NULL;
var $_output = FALSE;
var $_joblog = FALSE;
var $_semicolon = FALSE;
var $_config;
// optional arguments
var $_site = 'localhost';
var $_user = NULL;
var $_password = NULL;
/**
* via the command line
* @var array
*/
public $_required_arguments = array('action', 'entity');
public $_additional_arguments = array();
public $_entity = NULL;
public $_action = NULL;
public $_output = FALSE;
public $_joblog = FALSE;
public $_semicolon = FALSE;
public $_config;
/**
* optional arguments
* @var string
*/
public $_site = 'localhost';
public $_user = NULL;
public $_password = NULL;
// all other arguments populate the parameters
// array that is passed to civicrm_api
var $_params = array('version' => 3);
/**
* array that is passed to civicrm_api
* @var array
*/
public $_params = array('version' => 3);
var $_errors = array();
public $_errors = array();
/**
* @return bool
......@@ -340,7 +349,7 @@ class civicrm_cli {
* the database in a csv file format.
*/
class civicrm_cli_csv_exporter extends civicrm_cli {
var $separator = ',';
public $separator = ',';
/**
*/
......@@ -391,8 +400,8 @@ class civicrm_cli_csv_exporter extends civicrm_cli {
* passed to the script.
*/
class civicrm_cli_csv_file extends civicrm_cli {
var $header;
var $separator = ',';
public $header;
public $separator = ',';
/**
*/
......@@ -441,6 +450,7 @@ class civicrm_cli_csv_file extends civicrm_cli {
}
/* return a params as expected */
/**
* @param $data
*
......@@ -468,6 +478,7 @@ class civicrm_cli_csv_file extends civicrm_cli {
*
*/
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
/**
* @param array $params
*/
......@@ -489,6 +500,7 @@ class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
*
*/
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
/**
* @param array $params
*/
......
......@@ -64,10 +64,12 @@ namespace _CiviVersion_ {
'administrator/components/com_civicrm/civicrm/civicrm-version.php',
),
'Drupal' => array(
'modules/system/system.module', // D7
// D7
'modules/system/system.module',
),
'Drupal8' => array(
'core/core.services.yml', // D8
// D8
'core/core.services.yml',
),
'Backdrop' => array(
'core/modules/layout/layout.module',
......@@ -112,6 +114,7 @@ namespace _CiviVersion_ {
}
namespace {
/**
* Get the CiviCRM version.
* TODO : For now this function is not included in \Civi\Version class so not to break any code
......@@ -125,4 +128,5 @@ namespace {
'cms' => \_CiviVersion_\Util::findCMS(),
];
}
}
......@@ -163,7 +163,7 @@ elseif ($installType == 'backdrop') {
$object = new CRM_Utils_System_Backdrop();
$cmsPath = $object->cmsRootPath();
$siteDir = getSiteDir($cmsPath, $_SERVER['SCRIPT_FILENAME']);
$alreadyInstalled = file_exists($cmsPath . CIVICRM_DIRECTORY_SEPARATOR . 'civicrm.settings.php');
$alreadyInstalled = file_exists($cmsPath . CIVICRM_DIRECTORY_SEPARATOR . 'civicrm.settings.php');
}
elseif ($installType == 'wordpress') {
$cmsPath = WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'civicrm';
......@@ -424,7 +424,10 @@ else {
* $description[2] - The test error to show, if it goes wrong
*/
class InstallRequirements {
var $errors, $warnings, $tests, $conn;
public $errors;
public $warnings;
public $tests;
public $conn;
// @see CRM_Upgrade_Form::MINIMUM_THREAD_STACK
const MINIMUM_THREAD_STACK = 192;
......@@ -1170,7 +1173,6 @@ class InstallRequirements {
mysqli_query($conn, 'DROP TABLE civicrm_install_temp_table_test');
}
/**
* @param $server
* @param string $username
......@@ -1274,7 +1276,8 @@ class InstallRequirements {
return;
}
$result = mysqli_query($conn, "SHOW VARIABLES LIKE 'thread_stack'"); // bytes => kb
// bytes => kb
$result = mysqli_query($conn, "SHOW VARIABLES LIKE 'thread_stack'");
if (!$result) {
$testDetails[2] = ts('Could not get information about the thread_stack of the database.');
$this->error($testDetails);
......@@ -1519,6 +1522,7 @@ class InstallRequirements {
* Class Installer
*/
class Installer extends InstallRequirements {
/**
* @param $server
* @param $username
......@@ -1729,10 +1733,9 @@ class Installer extends InstallRequirements {
//change the default language to one chosen
if (isset($config['seedLanguage']) && $config['seedLanguage'] != 'en_US') {
civicrm_api3('Setting', 'create', array(
'domain_id' => 'current_domain',
'lcMessages' => $config['seedLanguage'],
)
);
'domain_id' => 'current_domain',
'lcMessages' => $config['seedLanguage'],
));
}
$output .= '</ul>';
......
......@@ -196,16 +196,23 @@ class CRM_GCD {
$this->householdIndividual = array_combine($this->Household, $this->householdIndividual);
}
/*********************************
/*
* private members
*********************************/
*
*/
// enum's from database
/**
* enum's from database
* @var array
*/
private $preferredCommunicationMethod = array('1', '2', '3', '4', '5');
private $contactType = array('Individual', 'Household', 'Organization');
private $phoneType = array('1', '2', '3', '4');
// customizable enums (foreign keys)
/**
* customizable enums (foreign keys)
* @var array
*/
private $prefix = array(
// Female
1 => array(
......@@ -219,35 +226,56 @@ class CRM_GCD {
4 => 'Dr.',
),
);
/**
* @var array
*/
private $suffix = array(1 => 'Jr.', 2 => 'Sr.', 3 => 'II', 4 => 'III');
private $gender = array(1 => 'female', 2 => 'male');
// store domain id's
/**
* store domain id's
* @var array
*/
private $domain = array();
// store contact id's
/**
* store contact id's
* @var array
*/
private $contact = array();
private $Individual = array();
private $Household = array();
private $Organization = array();
// store which contacts have a location entity
// for automatic management of is_primary field
/**
* for automatic management of is_primary field
* @var array
*/
private $location = array(
'Email' => array(),
'Phone' => array(),
'Address' => array(),
);
// stores the strict individual id and household id to individual id mapping
/**
* stores the strict individual id and household id to individual id mapping
* @var array
*/
private $strictIndividual = array();
private $householdIndividual = array();
private $householdName = array();
// sample data in xml format
/**
* sample data in xml format
* @var array
*/
private $sampleData = array();
// private vars
/**
* private vars
* @var array
*/
private $startCid;
private $numIndividual = 0;
private $numHousehold = 0;
......@@ -261,7 +289,7 @@ class CRM_GCD {
/*********************************
* private methods
********************************
* *******************************
* @param int $size
* @return string
*/
......
......@@ -33,7 +33,7 @@
*
*/
/*******************************************************
/**
* This class generates data for the schema located in Contact.sql
*
* each public method generates data for the concerned table.
......@@ -74,9 +74,9 @@
* Contact Location = 15% for Households, 10% for Organizations, (75-(15*4))% for Individuals.
* (Assumption is that each household contains 4 individuals)
*
*******************************************************/
*/
/*******************************************************
/**
*
* Note: implication of using of mt_srand(1) in constructor
* The data generated will be done in a consistent manner
......@@ -86,7 +86,7 @@
* to get consistent random numbers then the mt_srand(1) shld
* be in each function that adds data to each table.
*
*******************************************************/
*/
require_once '../civicrm.config.php';
......@@ -117,9 +117,9 @@ require_once 'CRM/Member/DAO/MembershipPayment.php';
*/
class CRM_GCD {
/*******************************************************
/**
* constants
*******************************************************/
*/
const DATA_FILENAME = "sample_data.xml";
const NUM_DOMAIN = 1;
const NUM_CONTACT = 5000;
......@@ -149,32 +149,47 @@ class CRM_GCD {
//const ADD_TO_DB=FALSE;
const DEBUG_LEVEL = 1;
/*********************************
/***
* private members
*********************************/
*/
// enum's from database
/**
* enum's from database
* @var array
*/
private $preferredCommunicationMethod = array('1', '2', '3', '4', '5');
private $contactType = array('Individual', 'Household', 'Organization');
private $phoneType = array('1', '2', '3', '4');
// customizable enums (foreign keys)
/**
* customizable enums (foreign keys)
* @var array
*/
private $prefix = array(1 => 'Mrs', 2 => 'Ms', 3 => 'Mr', 4 => 'Dr');
private $suffix = array(1 => 'Jr', 2 => 'Sr');
private $gender = array(1 => 'Female', 2 => 'Male');
private $greetingType = array(1 => 'Dear [first]', 2 => 'Dear [prefix] [first] [last]', 3 => 'Dear [prefix] [last]');
// store domain id's
/**
* store domain id's
* @var array
*/
private $domain = array();
// store contact id's
/**
* store contact id's
* @var array
*/
private $contact = array();
private $individual = array();
private $household = array();
private $organization = array();
// store names, firstnames, street 1, street2
/**
* store names, firstnames, street 1, street2
* @var array
*/
private $firstName = array();
private $lastName = array();
private $streetName = array();
......@@ -198,14 +213,23 @@ class CRM_GCD {
private $degree = array();
private $school = array();
// stores the strict individual id and household id to individual id mapping
/**
* stores the strict individual id and household id to individual id mapping
* @var array
*/
private $strictIndividual = array();
private $householdIndividual = array();
// sample data in xml format
/**
* sample data in xml format
* @var int
*/
private $sampleData = NULL;
// private vars
/**
* private vars
* @var int
*/
private $numIndividual = 0;
private $numHousehold = 0;
private $numOrganization = 0;
......@@ -234,13 +258,15 @@ class CRM_GCD {
1116 => array('Gdańsk', 'Gdynia'),
),
);
/**
* @var array
*/
private $groupMembershipStatus = array('Added', 'Removed', 'Pending');
private $subscriptionHistoryMethod = array('Admin', 'Email');
/*********************************
/**
* private methods
********************************
*
* @param int $size
* @return string
*/
......@@ -298,8 +324,8 @@ class CRM_GCD {
return mt_rand(1, count($array1));
}
// country state city combo
/**
* @return array
*/
......@@ -375,8 +401,8 @@ class CRM_GCD {
return date($dateFormat, mt_rand($today - $numSecond, $today));
}
// insert data into db's
/**
* @param $dao
*/
......@@ -391,6 +417,7 @@ class CRM_GCD {
}
// update data into db's
/**
* @param $dao
*/
......@@ -571,7 +598,6 @@ class CRM_GCD {
}
}
public function initDB() {
$config = CRM_Core_Config::singleton();
}
......@@ -1213,7 +1239,8 @@ class CRM_GCD {
$this->_insert($activityContactDAO);
if (in_array($activityTypeID, array(
6, 9))) {
6, 9,
))) {
$activityTargetDAO = new CRM_Activity_DAO_ActivityContact();
$activityTargetDAO->activity_id = $activityDAO->id;
$activityTargetDAO->contact_id = mt_rand(1, 101);
......@@ -1703,7 +1730,6 @@ function module_list() {
return array();
}
echo ("Starting data generation on " . date("F dS h:i:s A") . "\n");
$obj1 = new CRM_GCD();
$obj1->initID();
......
......@@ -22,7 +22,8 @@ if ($memLimit >= 0 and $memLimit < 536870912) {
// Note: When processing all locales, CRM_Core_I18n::singleton() eats a lot of RAM.
ini_set('memory_limit', -1);
}
date_default_timezone_set('UTC'); // avoid php warnings if timezone is not set - CRM-10844
// avoid php warnings if timezone is not set - CRM-10844
date_default_timezone_set('UTC');
define('CIVICRM_UF', 'Drupal');
define('CIVICRM_UF_BASEURL', '/');
......@@ -32,14 +33,23 @@ CRM_Core_ClassLoader::singleton()->register();
# TODO: pull these settings from configuration
$genCode = new CRM_Core_CodeGen_Main(
'../CRM/Core/DAO/', // $CoreDAOCodePath
'../sql/', // $sqlCodePath
'../', // $phpCodePath
'../templates/', // $tplCodePath
NULL, // IGNORE
@$argv[3], // cms
empty($argv[2]) ? NULL : $argv[2], // db version
empty($argv[1]) ? 'schema/Schema.xml' : $argv[1], // schema file
getenv('CIVICRM_GENCODE_DIGEST') ? getenv('CIVICRM_GENCODE_DIGEST') : NULL // path to digest file
// $CoreDAOCodePath
'../CRM/Core/DAO/',
// $sqlCodePath
'../sql/',
// $phpCodePath
'../',
// $tplCodePath
'../templates/',
// IGNORE
NULL,
// cms
@$argv[3],
// db version
empty($argv[2]) ? NULL : $argv[2],
// schema file
empty($argv[1]) ? 'schema/Schema.xml' : $argv[1],
// path to digest file
getenv('CIVICRM_GENCODE_DIGEST') ? getenv('CIVICRM_GENCODE_DIGEST') : NULL
);
$genCode->main();
<?php
/**
* @param array $params
* @param $text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment