From 2e6c66d7e13f2a78807ad4e837f35a41f1a97db2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 30 Jan 2023 13:19:41 +1300 Subject: [PATCH] Minor tidy ups --- Civixero.php | 13 ++++++------- packages/Xero/Xero.php | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Civixero.php b/Civixero.php index dbff6843..9137cb02 100755 --- a/Civixero.php +++ b/Civixero.php @@ -59,7 +59,7 @@ function civixero_is_extension_installed(string $extension): bool { * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterSettingsMetaData/ */ -function civixero_civicrm_alterSettingsMetaData(array &$settingsMetaData, int $domainID, $profile): void { +function civixero_civicrm_alterSettingsMetaData(array &$settingsMetaData): void { $weight = 100; foreach ($settingsMetaData as $index => $setting) { if (($setting['group'] ?? '') === 'accountsync') { @@ -72,14 +72,14 @@ function civixero_civicrm_alterSettingsMetaData(array &$settingsMetaData, int $d /** * Get contributions for a single contact. * - * @param int $contactid + * @param int $contactID * * @return array * @throws \CiviCRM_API3_Exception */ -function getContactContributions(int $contactid): array { +function getContactContributions(int $contactID): array { $contributions = civicrm_api3('Contribution', 'get', [ - 'contact_id' => $contactid, + 'contact_id' => $contactID, 'return' => ['contribution_id'], 'sequential' => TRUE, ])['values']; @@ -95,7 +95,7 @@ function getContactContributions(int $contactid): array { * * @throws \CiviCRM_API3_Exception */ -function getErroredInvoicesOfContributions($contributions) { +function getErroredInvoicesOfContributions(array $contributions): array { return civicrm_api3('AccountInvoice', 'get', [ 'plugin' => 'xero', 'sequential' => TRUE, @@ -231,8 +231,7 @@ function _civixero_get_connectors(): array { $connectors = civicrm_api3('connector', 'get', ['connector_type_id' => 'CiviXero']); $connectors = $connectors['values']; } - /** @noinspection PhpUnusedLocalVariableInspection */ - catch (CiviCRM_API3_Exception $e) { + catch (CRM_Core_Exception $e) { $connectors = [0 => 0]; } } diff --git a/packages/Xero/Xero.php b/packages/Xero/Xero.php index ce89f3e0..15bfe656 100755 --- a/packages/Xero/Xero.php +++ b/packages/Xero/Xero.php @@ -266,7 +266,6 @@ public function __call($name, $arguments) { try { if (@simplexml_load_string($temp_xero_response) == FALSE) { throw new XeroException($temp_xero_response); - $xero_xml = FALSE; } else { $xero_xml = simplexml_load_string($temp_xero_response);