Skip to content

Commit

Permalink
(NFC) Lint additional php files up to the new coder standard
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Apr 11, 2019
1 parent 33484eb commit 683bf89
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 96 deletions.
8 changes: 4 additions & 4 deletions CRM/ACL/BAO/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/BAO/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache {

static $_cache = NULL;
public static $_cache = NULL;

/**
* @param int $id
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/BAO/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/Page/ACL.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/Page/ACLBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/ACL/Page/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/Badge/Page/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions CRM/Contact/BAO/ContactType.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@ public static function isaSubType($subType, $ignoreCache = FALSE) {
/**
* 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;
Expand Down Expand Up @@ -664,7 +665,7 @@ public static function add(&$params) {
else {
$name = self::getBasicType($contactName);
if (!$name) {
return;
return NULL;
}
$value = ['name' => "New $name"];
CRM_Core_BAO_Navigation::retrieve($value, $navinfo);
Expand Down Expand Up @@ -891,6 +892,7 @@ public static function deleteCustomSetForSubtypeMigration(
* Custom group id.
* @param array $subtypes
* List of subtypes related to which entry is to be removed.
* @param array $subtypesToPreserve
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Page/Premium.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion CRM/Widget/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class CRM_Widget_Widget {

static $_methodTable;
public static $_methodTable;

public function initialize() {
if (!self::$_methodTable) {
Expand Down
2 changes: 1 addition & 1 deletion Civi.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Civi {

/**
* A central location for static variable storage.
*
* @var array
* @code
* `Civi::$statics[__CLASS__]['foo'] = 'bar';
* @endcode
Expand Down
13 changes: 8 additions & 5 deletions bin/ContributionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
52 changes: 32 additions & 20 deletions bin/cli.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -340,7 +349,7 @@ private function _log($error) {
* the database in a csv file format.
*/
class civicrm_cli_csv_exporter extends civicrm_cli {
var $separator = ',';
public $separator = ',';

/**
*/
Expand Down Expand Up @@ -391,8 +400,8 @@ public function run() {
* passed to the script.
*/
class civicrm_cli_csv_file extends civicrm_cli {
var $header;
var $separator = ',';
public $header;
public $separator = ',';

/**
*/
Expand Down Expand Up @@ -441,6 +450,7 @@ public function run() {
}

/* return a params as expected */

/**
* @param $data
*
Expand Down Expand Up @@ -468,6 +478,7 @@ public function convertLine($data) {
*
*/
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {

/**
* @param array $params
*/
Expand All @@ -489,6 +500,7 @@ public function processline($params) {
*
*/
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {

/**
* @param array $params
*/
Expand Down
8 changes: 6 additions & 2 deletions civicrm-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ public static function findCMSRootPath() {
'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',
Expand Down Expand Up @@ -112,6 +114,7 @@ public static function getSearchDir() {
}

namespace {

/**
* Get the CiviCRM version.
* TODO : For now this function is not included in \Civi\Version class so not to break any code
Expand All @@ -125,4 +128,5 @@ function civicrmVersion() {
'cms' => \_CiviVersion_\Util::findCMS(),
];
}

}
19 changes: 11 additions & 8 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
$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';
Expand Down Expand Up @@ -424,7 +424,10 @@
* $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;
Expand Down Expand Up @@ -1170,7 +1173,6 @@ public function requireMySQLTrigger($server, $username, $password, $database, $t
mysqli_query($conn, 'DROP TABLE civicrm_install_temp_table_test');
}


/**
* @param $server
* @param string $username
Expand Down Expand Up @@ -1274,7 +1276,8 @@ public function requireMySQLThreadStack($server, $username, $password, $database
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);
Expand Down Expand Up @@ -1519,6 +1522,7 @@ public function hasWarnings() {
* Class Installer
*/
class Installer extends InstallRequirements {

/**
* @param $server
* @param $username
Expand Down Expand Up @@ -1729,10 +1733,9 @@ public function install($config) {
//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>';
Expand Down
Loading

0 comments on commit 683bf89

Please sign in to comment.