Commit 7b966967 authored by Seamus Lee's avatar Seamus Lee

(NFC) Update CRM/Cxn CRM/Dashlet CRM/Export CRM/Extension and CRM/Financial...

(NFC) Update CRM/Cxn CRM/Dashlet CRM/Export CRM/Extension and CRM/Financial files to new coder style
parent fb1a4c6f
......@@ -165,7 +165,7 @@ class CRM_Cxn_BAO_Cxn extends CRM_Cxn_DAO_Cxn {
}
/**
* @return DefaultCertificateValidator
* @return \Civi\Cxn\Rpc\DefaultCertificateValidator
* @throws CRM_Core_Exception
*/
public static function createCertificateValidator() {
......
......@@ -44,8 +44,9 @@ class CRM_Dashlet_Page_GettingStarted extends CRM_Core_Page {
/**
* Define tokens available for getting started
* @var array
*/
static $_tokens = [
public static $_tokens = [
'crmurl' => [
'configbackend' => 'civicrm/admin/configtask',
],
......@@ -121,7 +122,6 @@ class CRM_Dashlet_Page_GettingStarted extends CRM_Core_Page {
return $html;
}
/**
* @param array $tokensList
* @param string $str
......
......@@ -47,7 +47,7 @@ class CRM_Export_BAO_Export {
* @param int $exportMode
* Export mode.
*
* @return string $property
* @return string
* Default Return property
*/
public static function defaultReturnProperty($exportMode) {
......@@ -83,7 +83,7 @@ class CRM_Export_BAO_Export {
* @param int $exportMode
* Export mode.
*
* @return string $component
* @return string
* CiviCRM Export Component
*/
public static function exportComponent($exportMode) {
......@@ -120,7 +120,7 @@ class CRM_Export_BAO_Export {
* @param object $query
* CRM_Contact_BAO_Query
*
* @return string $groupBy
* @return string
* Group By Clause
*/
public static function getGroupBy($processor, $returnProperties, $query) {
......@@ -1135,8 +1135,7 @@ LIMIT $offset, $limit
'email_greeting',
'postal_greeting',
'addressee',
])
) {
])) {
//special case for greeting replacement
$fldValue = "{$relationField}_display";
$fieldValue = $relDAO->$fldValue;
......
......@@ -93,7 +93,7 @@ class CRM_Export_BAO_ExportProcessor {
*
* e.g. ['8_b_a' => 'Household Member Is', '8_a_b = 'Household Member Of'.....]
*
* @var
* @var array
*/
protected $relationshipTypes = [];
......@@ -168,6 +168,7 @@ class CRM_Export_BAO_ExportProcessor {
public function setIsPostalableOnly($isPostalableOnly) {
$this->isPostalableOnly = $isPostalableOnly;
}
/**
* @return array|null
*/
......@@ -313,7 +314,6 @@ class CRM_Export_BAO_ExportProcessor {
return array_key_exists($fieldName, $this->relationshipTypes);
}
/**
* @param $fieldName
* @return bool
......@@ -1002,7 +1002,7 @@ class CRM_Export_BAO_ExportProcessor {
$skippedFields = ($this->getQueryMode() === CRM_Contact_BAO_Query::MODE_CONTACTS) ? [] : [
'groups',
'tags',
'notes'
'notes',
];
foreach ($fields as $key => $var) {
......
......@@ -108,8 +108,7 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
'icon' => 'fa-times',
'name' => ts('Done'),
],
]
);
]);
}
/**
......
......@@ -142,7 +142,8 @@ class CRM_Export_Form_Select extends CRM_Core_Form_Task {
if ($formName == 'CRM_Export_StateMachine_Standalone') {
$componentName = ['CRM', $this->controller->get('entity')];
}
$entityShortname = $componentName[1]; // Contact
// Contact
$entityShortname = $componentName[1];
$entityDAOName = $entityShortname;
break;
}
......@@ -326,8 +327,7 @@ FROM {$this->_componentTable}
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
$this->addFormRule(['CRM_Export_Form_Select', 'formRule'], $this);
}
......
......@@ -35,6 +35,7 @@
* scanned for extensions.
*/
class CRM_Extension_Container_Static implements CRM_Extension_Container_Interface {
/**
* @param array $exts
* Array(string $key => array $spec) List of extensions.
......
......@@ -38,6 +38,9 @@ class CRM_Extension_Info {
*/
const FILENAME = 'info.xml';
/**
* @var string
*/
public $key = NULL;
public $type = NULL;
public $name = NULL;
......
......@@ -135,7 +135,8 @@ class CRM_Extension_Manager {
case self::STATUS_INSTALLED:
case self::STATUS_DISABLED:
// There is an old copy of the extension. Try to install in the same place -- but it must go somewhere in the default-container
list ($oldInfo, $typeManager) = $this->_getInfoTypeHandler($newInfo->key); // throws Exception
// throws Exception
list ($oldInfo, $typeManager) = $this->_getInfoTypeHandler($newInfo->key);
$tgtPath = $this->fullContainer->getPath($newInfo->key);
if (!CRM_Utils_File::isChildPath($this->defaultContainer->getBaseDir(), $tgtPath)) {
// force installation in the default-container
......@@ -152,7 +153,8 @@ class CRM_Extension_Manager {
case self::STATUS_DISABLED_MISSING:
// the extension does not exist in any container; we're free to put it anywhere
$tgtPath = $this->defaultContainer->getBaseDir() . DIRECTORY_SEPARATOR . $newInfo->key;
list ($oldInfo, $typeManager) = $this->_getMissingInfoTypeHandler($newInfo->key); // throws Exception
// throws Exception
list ($oldInfo, $typeManager) = $this->_getMissingInfoTypeHandler($newInfo->key);
break;
case self::STATUS_UNKNOWN:
......@@ -210,7 +212,8 @@ class CRM_Extension_Manager {
// keys/statuses/types before doing anything
foreach ($keys as $key) {
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getInfoTypeHandler($key);
switch ($origStatuses[$key]) {
case self::STATUS_INSTALLED:
......@@ -254,7 +257,8 @@ class CRM_Extension_Manager {
$schema->fixSchemaDifferences();
foreach ($keys as $key) {
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getInfoTypeHandler($key);
switch ($origStatuses[$key]) {
case self::STATUS_INSTALLED:
......@@ -304,7 +308,8 @@ class CRM_Extension_Manager {
sort($keys);
$disableRequirements = $this->findDisableRequirements($keys);
sort($disableRequirements); // This munges order, but makes it comparable.
// This munges order, but makes it comparable.
sort($disableRequirements);
if ($keys !== $disableRequirements) {
throw new CRM_Extension_Exception_DependencyException("Cannot disable extension due dependencies. Consider disabling all these: " . implode(',', $disableRequirements));
}
......@@ -312,14 +317,16 @@ class CRM_Extension_Manager {
foreach ($keys as $key) {
switch ($origStatuses[$key]) {
case self::STATUS_INSTALLED:
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getInfoTypeHandler($key);
$typeManager->onPreDisable($info);
$this->_setExtensionActive($info, 0);
$typeManager->onPostDisable($info);
break;
case self::STATUS_INSTALLED_MISSING:
list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key);
$typeManager->onPreDisable($info);
$this->_setExtensionActive($info, 0);
$typeManager->onPostDisable($info);
......@@ -364,14 +371,16 @@ class CRM_Extension_Manager {
throw new CRM_Extension_Exception("Cannot uninstall extension; disable it first: $key");
case self::STATUS_DISABLED:
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getInfoTypeHandler($key);
$typeManager->onPreUninstall($info);
$this->_removeExtensionEntry($info);
$typeManager->onPostUninstall($info);
break;
case self::STATUS_DISABLED_MISSING:
list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key); // throws Exception
// throws Exception
list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key);
$typeManager->onPreUninstall($info);
$this->_removeExtensionEntry($info);
$typeManager->onPostUninstall($info);
......@@ -450,7 +459,8 @@ class CRM_Extension_Manager {
public function refresh() {
$this->statuses = NULL;
$this->fullContainer->refresh(); // and, indirectly, defaultContainer
// and, indirectly, defaultContainer
$this->fullContainer->refresh();
$this->mapper->refresh();
}
......@@ -466,7 +476,8 @@ class CRM_Extension_Manager {
* (0 => CRM_Extension_Info, 1 => CRM_Extension_Manager_Interface)
*/
private function _getInfoTypeHandler($key) {
$info = $this->mapper->keyToInfo($key); // throws Exception
// throws Exception
$info = $this->mapper->keyToInfo($key);
if (array_key_exists($info->type, $this->typeManagers)) {
return [$info, $this->typeManagers[$info->type]];
}
......@@ -595,8 +606,10 @@ class CRM_Extension_Manager {
*/
public function findInstallRequirements($keys) {
$infos = $this->mapper->getAllInfos();
$todoKeys = array_unique($keys); // array(string $key).
$doneKeys = []; // array(string $key => 1);
// array(string $key).
$todoKeys = array_unique($keys);
// array(string $key => 1);
$doneKeys = [];
$sorter = new \MJS\TopSort\Implementations\FixedArraySort();
while (!empty($todoKeys)) {
......
......@@ -33,6 +33,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
interface CRM_Extension_Manager_Interface {
/**
* Perform type-specific installation logic (before marking the
* extension as installed or clearing the caches).
......
......@@ -265,8 +265,7 @@ class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
if (method_exists($processorInstance, $method) && is_callable([
$processorInstance,
$method,
])
) {
])) {
// If so, call it ...
$processorInstance->$method();
}
......
......@@ -109,7 +109,8 @@ class CRM_Extension_System {
if (!array_key_exists('domain_id', $parameters)) {
$parameters['domain_id'] = CRM_Core_Config::domainID();
}
ksort($parameters); // guaranteed ordering - useful for md5(serialize($parameters))
// guaranteed ordering - useful for md5(serialize($parameters))
ksort($parameters);
$this->parameters = $parameters;
}
......@@ -243,7 +244,8 @@ class CRM_Extension_System {
$this->downloader = new CRM_Extension_Downloader(
$this->getManager(),
$basedir,
CRM_Utils_File::tempdir() // WAS: $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
// WAS: $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
CRM_Utils_File::tempdir()
);
}
return $this->downloader;
......@@ -323,7 +325,8 @@ class CRM_Extension_System {
switch ($extensionRow['status']) {
case CRM_Extension_Manager::STATUS_UNINSTALLED:
$extensionRow['statusLabel'] = ''; // ts('Uninstalled');
// ts('Uninstalled');
$extensionRow['statusLabel'] = '';
break;
case CRM_Extension_Manager::STATUS_DISABLED:
......@@ -331,7 +334,8 @@ class CRM_Extension_System {
break;
case CRM_Extension_Manager::STATUS_INSTALLED:
$extensionRow['statusLabel'] = ts('Enabled'); // ts('Installed');
// ts('Installed');
$extensionRow['statusLabel'] = ts('Enabled');
break;
case CRM_Extension_Manager::STATUS_DISABLED_MISSING:
......@@ -339,7 +343,8 @@ class CRM_Extension_System {
break;
case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
$extensionRow['statusLabel'] = ts('Enabled (Missing)'); // ts('Installed');
// ts('Installed');
$extensionRow['statusLabel'] = ts('Enabled (Missing)');
break;
default:
......
......@@ -91,7 +91,7 @@ abstract class CRM_Financial_BAO_ExportFormat {
*
* @param $exportDaos array with DAO's for queries to be exported.
*/
public abstract function makeExport($exportDaos);
abstract public function makeExport($exportDaos);
/**
* @return string
......@@ -108,7 +108,7 @@ abstract class CRM_Financial_BAO_ExportFormat {
*
* @return string
*/
public abstract function getFileExtension();
abstract public function getFileExtension();
/**
* @return object
......@@ -131,6 +131,7 @@ abstract class CRM_Financial_BAO_ExportFormat {
* Depending on the output format might want to override this, e.g. for IIF tabs need to be escaped etc,
* but for CSV it doesn't make sense because php has built in csv output functions.
*/
/**
* @param $s
* @param string $type
......@@ -162,7 +163,8 @@ abstract class CRM_Financial_BAO_ExportFormat {
ob_clean();
flush();
readfile($config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($zip)));
unlink($zip); //delete the zip to avoid clutter.
//delete the zip to avoid clutter.
unlink($zip);
CRM_Utils_System::civiExit();
}
}
......
......@@ -41,6 +41,7 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
* referenced in the journal entries that isn't defined anywhere.
*
* Possibly in the future this could be selected by the user.
* @var array
*/
public static $complementaryTables = [
'ACCNT',
......
......@@ -39,14 +39,16 @@ class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat
/**
* Tab character. Some people's editors replace tabs with spaces so I'm scared to use actual tabs.
* Can't set it here using chr() because static. Same thing if a const. So it's set in constructor.
* @var string
*/
static $SEPARATOR;
public static $SEPARATOR;
/**
* For this phase, we always output these records too so that there isn't data
* referenced in the journal entries that isn't defined anywhere.
*
* Possibly in the future this could be selected by the user.
* @var array
*/
public static $complementaryTables = [
'ACCNT',
......
......@@ -34,12 +34,15 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
/**
* Static cache holder of available financial types for this session
* @var array
*/
static $_availableFinancialTypes = [];
public static $_availableFinancialTypes = [];
/**
* Static cache holder of status of ACL-FT enabled/disabled for this session
* @var array
*/
static $_statusACLFt = [];
public static $_statusACLFt = [];
/**
* Class constructor.
......
......@@ -205,6 +205,7 @@ class CRM_Financial_BAO_Payment {
]);
return (int) $contribution['contact_id'];
}
/**
* @param array $entities
* Related entities as an array keyed by the various entities.
......@@ -268,7 +269,7 @@ class CRM_Financial_BAO_Payment {
'refundAmount',
'totalPaid',
'paymentsComplete',
'emailGreeting'
'emailGreeting',
];
// These are assigned by the payment form - they still 'get through' from the
// form for now without being in here but we should ideally load
......
......@@ -37,8 +37,9 @@
class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProcessor {
/**
* Static holder for the default payment processor
* @var object
*/
static $_defaultPaymentProcessor = NULL;
public static $_defaultPaymentProcessor = NULL;
/**
* Create Payment Processor.
......
......@@ -34,8 +34,9 @@ class CRM_Financial_BAO_PaymentProcessorType extends CRM_Financial_DAO_PaymentPr
/**
* Static holder for the default payment processor.
* @var object
*/
static $_defaultPaymentProcessorType = NULL;
public static $_defaultPaymentProcessorType = NULL;
/**
* Class constructor.
......@@ -199,7 +200,7 @@ WHERE pp.payment_processor_type_id = ppt.id AND ppt.id = %1";
*
* @return array
*/
static private function getAllPaymentProcessorTypes($attr) {
private static function getAllPaymentProcessorTypes($attr) {
$ppt = [];
$dao = new CRM_Financial_DAO_PaymentProcessorType();
$dao->find();
......
......@@ -35,18 +35,18 @@
* This class generates form components for Financial Type
*/
class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
static $_links = NULL;
static $_entityID;
public static $_links = NULL;
public static $_entityID;
/**
* Batch status.
* @var
* @var int
*/
protected $_batchStatusId;
/**
* Batch status name.
* @string
* @var string
*/
protected $_batchStatus;
......
......@@ -47,21 +47,25 @@ class CRM_Financial_Form_Export extends CRM_Core_Form {
/**
* Financial batch ids.
* @var array
*/
protected $_batchIds = [];
/**
* Export status id.
* @var int
*/
protected $_exportStatusId;
/**
* Export format.
* @var string
*/
protected $_exportFormat;
/**
* Download export File.
* @var bool
*/
protected $_downloadFile = TRUE;
......
......@@ -43,7 +43,6 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
*/
protected $_isARFlag = FALSE;
/**
* Set variables up before form is built.
*/
......
......@@ -200,8 +200,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
$this->addFormRule(['CRM_Financial_Form_FinancialTypeAccount', 'formRule'], $this);
}
......
......@@ -59,6 +59,7 @@ class CRM_Financial_Form_PaymentEdit extends CRM_Core_Form {
public function getDefaultContext() {
return 'create';
}
/**
* Set variables up before form is built.
*/
......
......@@ -30,7 +30,6 @@
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2019
*/
trait CRM_Financial_Form_SalesTaxTrait {
/**
......
......@@ -41,7 +41,7 @@ class CRM_Financial_Page_Batch extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -41,11 +41,11 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
static $_entityID;
public static $_links = NULL;
public static $_entityID;
static $_columnHeader = NULL;
static $_returnvalues = NULL;
public static $_columnHeader = NULL;
public static $_returnvalues = NULL;
/**
* Get BAO Name.
......@@ -91,7 +91,8 @@ class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic {
*/
public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse'
// default to 'browse'
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
......
......@@ -42,7 +42,7 @@ class CRM_Financial_Page_FinancialAccount extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -41,7 +41,7 @@ class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......@@ -92,7 +92,6 @@ class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic {
return CRM_Core_Page::run();
}
/**
* Get name of edit form.
*
......
......@@ -42,7 +42,7 @@ class CRM_Financial_Page_FinancialType extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -40,7 +40,7 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* The account id that we need to display for the browse screen.
......@@ -94,7 +94,8 @@ class CRM_Financial_Page_FinancialTypeAccount extends CRM_Core_Page {
*/
public function run() {
// get the requested action
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse'
// default to 'browse'
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
// assign vars to templates
$this->assign('action', $action);
......
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