From 97dd97bf5f3a723fc3490195894a3a49eeed41bf Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Tue, 24 Oct 2023 22:54:12 -0400 Subject: [PATCH 1/5] add member variable to make IDE analysis better --- src/ChurchCRM/Reports/PDF_Directory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ChurchCRM/Reports/PDF_Directory.php b/src/ChurchCRM/Reports/PDF_Directory.php index f1aefafa69..bed403d3ca 100644 --- a/src/ChurchCRM/Reports/PDF_Directory.php +++ b/src/ChurchCRM/Reports/PDF_Directory.php @@ -18,6 +18,7 @@ class PDF_Directory extends ChurchInfoReport public $_Gutter = 5; public $_LS = 4; public $sFamily; + public string $sRecordName; public $sLastName; public $_ColWidth = 58; public $_Custom = []; From a44ca13bec29a68454017d4d36652de62c893647 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Mon, 23 Oct 2023 12:18:17 -0400 Subject: [PATCH 2/5] fix invalid logging functions + small typos --- src/ChurchCRM/data/States.php | 4 ++-- src/SystemDBUpdate.php | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ChurchCRM/data/States.php b/src/ChurchCRM/data/States.php index 2af8c80072..f749be415a 100644 --- a/src/ChurchCRM/data/States.php +++ b/src/ChurchCRM/data/States.php @@ -13,8 +13,8 @@ public function __construct($countryCode) $this->countryCode = $countryCode; $stateFileName = SystemURLs::getDocumentRoot() . '/locale/states/'. $countryCode .'.json'; if( is_file($stateFileName)) { - $satesFile = file_get_contents($stateFileName); - $this->states = json_decode($satesFile, true, 512, JSON_THROW_ON_ERROR); + $statesFile = file_get_contents($stateFileName); + $this->states = json_decode($statesFile, true, 512, JSON_THROW_ON_ERROR); } } diff --git a/src/SystemDBUpdate.php b/src/SystemDBUpdate.php index 9497ef1628..fa4079e45f 100644 --- a/src/SystemDBUpdate.php +++ b/src/SystemDBUpdate.php @@ -17,16 +17,17 @@ exit; } -if (isset($_GET['upgrade']) && InputUtils::FilterString($_GET['upgrade']) == "true") { +$logger = LoggerUtils::getAppLogger(); +if (isset($_GET['upgrade']) && InputUtils::FilterString($_GET['upgrade']) === "true") { try { - LoggerUtils::getAppLogger()->info("Beginning database upgrade"); + $logger->info("Beginning database upgrade"); UpgradeService::upgradeDatabaseVersion(); - LoggerUtils::getAppLogger()->info("Complete database upgrade; redirecting to Main menu"); + $logger->info("Complete database upgrade; redirecting to Main menu"); RedirectUtils::Redirect('Menu.php'); exit; } catch (Exception $ex) { $errorMessage = $ex->getMessage(); - LoggerUtils::getAppLogger()->error("Error updating database: " .$errorMessage); + $logger->error("Error updating database: " .$errorMessage, ['exception' => $ex]); } } From bd6043778fddaa47f3104b51301d22e861766482 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Mon, 23 Oct 2023 13:07:09 -0400 Subject: [PATCH 3/5] ensure classes exist within namespace and fix types to inheritance errors --- .../Authentication/AuthenticationManager.php | 6 +++- .../Search/AddressSearchResultProvider.php | 2 +- .../CalendarEventSearchResultProvider.php | 2 +- .../Search/FamilySearchResultProvider.php | 4 +-- .../FinanceDepositSearchResultProvider.php | 2 +- .../FinancePaymentSearchResultProvider.php | 2 +- .../Search/GroupSearchResultProvider.php | 2 +- .../Search/PersonSearchResultProvider.php | 2 +- src/ChurchCRM/Search/SearchResultGroup.php | 19 ++++++----- src/ChurchCRM/data/Country.php | 3 +- src/ChurchCRM/dto/ChurchCRMRelease.php | 33 +++++++------------ src/Include/analyticstracking.php | 2 +- src/SystemDBUpdate.php | 2 +- src/api/routes/people/people-family.php | 2 +- 14 files changed, 40 insertions(+), 43 deletions(-) diff --git a/src/ChurchCRM/Authentication/AuthenticationManager.php b/src/ChurchCRM/Authentication/AuthenticationManager.php index 673c5bd9cd..0103ac3ec7 100644 --- a/src/ChurchCRM/Authentication/AuthenticationManager.php +++ b/src/ChurchCRM/Authentication/AuthenticationManager.php @@ -20,7 +20,11 @@ class AuthenticationManager // Currently, only local auth is implemented; hence the zero-indexed array elements. public static function GetAuthenticationProvider() { - if ( key_exists("AuthenticationProvider", $_SESSION) && $_SESSION['AuthenticationProvider'] instanceof IAuthenticationProvider) { + if ( + isset($_SESSION) && + array_key_exists('AuthenticationProvider', $_SESSION) && + $_SESSION['AuthenticationProvider'] instanceof IAuthenticationProvider + ) { return $_SESSION['AuthenticationProvider']; } else { diff --git a/src/ChurchCRM/Search/AddressSearchResultProvider.php b/src/ChurchCRM/Search/AddressSearchResultProvider.php index 46bd6149f8..8229594016 100644 --- a/src/ChurchCRM/Search/AddressSearchResultProvider.php +++ b/src/ChurchCRM/Search/AddressSearchResultProvider.php @@ -43,7 +43,7 @@ private function getPersonSearchResultsByPartialAddress(string $SearchQuery) { array_push($searchResults, new SearchResult("person-address-".$id, $address->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),$address->getViewURI())); } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } diff --git a/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php b/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php index 4a4c58648b..0c1aeac743 100644 --- a/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php +++ b/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php @@ -41,7 +41,7 @@ private function getCalendarEventSearchResultsByPartialName(string $SearchQuery) array_push($searchResults, new SearchResult("event-name-".$id, $event->getTitle(),$event->getViewURI())); } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FamilySearchResultProvider.php b/src/ChurchCRM/Search/FamilySearchResultProvider.php index e1adb5cbed..3db46b336e 100644 --- a/src/ChurchCRM/Search/FamilySearchResultProvider.php +++ b/src/ChurchCRM/Search/FamilySearchResultProvider.php @@ -51,7 +51,7 @@ private function getFamilySearchResultsByPartialName(string $SearchQuery) { } return $searchResults; - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } } @@ -74,7 +74,7 @@ private function getFamilySearchResultsByCustomProperties(string $SearchQuery) { $id++; array_push($searchResults, new SearchResult("family-custom-prop-".$id, $family->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),$family->getViewURI())); } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php b/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php index bd0aa66b1f..e71dad4bc6 100644 --- a/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php +++ b/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php @@ -45,7 +45,7 @@ private function getDepositSearchResults(string $SearchQuery) { array_push($searchResults, new SearchResult("finance-deposit-".$id, $Deposit['displayName'], $Deposit['uri'])); } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php b/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php index 001dd71a36..b1abb3750a 100644 --- a/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php +++ b/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php @@ -83,7 +83,7 @@ private function getPaymentSearchResults(string $SearchQuery) { } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/GroupSearchResultProvider.php b/src/ChurchCRM/Search/GroupSearchResultProvider.php index 53308beaaa..cf2c29a1f1 100644 --- a/src/ChurchCRM/Search/GroupSearchResultProvider.php +++ b/src/ChurchCRM/Search/GroupSearchResultProvider.php @@ -38,7 +38,7 @@ private function getPersonSearchResultsByPartialName(string $SearchQuery) { array_push($searchResults, new SearchResult("group-name-".$id, $group->getName(),$group->getViewURI())); } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/PersonSearchResultProvider.php b/src/ChurchCRM/Search/PersonSearchResultProvider.php index 809a5db738..6e2cf5dfba 100644 --- a/src/ChurchCRM/Search/PersonSearchResultProvider.php +++ b/src/ChurchCRM/Search/PersonSearchResultProvider.php @@ -45,7 +45,7 @@ private function getPersonSearchResultsByPartialName(string $SearchQuery) { array_push($searchResults, new SearchResult("person-name-".$id, $person->getFullName(),$person->getViewURI())); } } - } catch (Exception $e) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/SearchResultGroup.php b/src/ChurchCRM/Search/SearchResultGroup.php index 7ba9160945..8b3955bb3a 100644 --- a/src/ChurchCRM/Search/SearchResultGroup.php +++ b/src/ChurchCRM/Search/SearchResultGroup.php @@ -2,19 +2,22 @@ namespace ChurchCRM\Search; -class SearchResultGroup implements \JsonSerializable { - public $groupName; - public $results; +class SearchResultGroup implements \JsonSerializable +{ + private string $groupName; + private array $results; - public function __construct(string $groupName, array $results) { + public function __construct(string $groupName, array $results) + { $this->groupName = $groupName; $this->results = $results; } - public function jsonSerialize() { - return @[ - "text" => $this->groupName, - "children" => $this->results + public function jsonSerialize(): array + { + return [ + 'text' => $this->groupName, + 'children' => $this->results, ]; } } \ No newline at end of file diff --git a/src/ChurchCRM/data/Country.php b/src/ChurchCRM/data/Country.php index d996e183ed..b28ae865fe 100644 --- a/src/ChurchCRM/data/Country.php +++ b/src/ChurchCRM/data/Country.php @@ -5,7 +5,7 @@ class Country implements \JsonSerializable { private string $countryCode; private string $countryName; - private ?string $countryNameYasumi; + private ?string $countryNameYasumi = null; public function __construct(string $CountryCode, string $CountryName, string $CountryNameYasumi = null) { @@ -29,6 +29,7 @@ public function getCountryNameYasumi(): ?string return $this->countryNameYasumi; } + public function jsonSerialize(): array public function jsonSerialize(): array { return [ diff --git a/src/ChurchCRM/dto/ChurchCRMRelease.php b/src/ChurchCRM/dto/ChurchCRMRelease.php index cfb3f55d2e..38937fd8b9 100644 --- a/src/ChurchCRM/dto/ChurchCRMRelease.php +++ b/src/ChurchCRM/dto/ChurchCRMRelease.php @@ -1,9 +1,7 @@ rawRelease = $releaseArray; $versions = explode(".",$releaseArray["name"]); $this->MAJOR = $versions[0]; @@ -25,29 +23,21 @@ public function equals(ChurchCRMRelease $b) { } public function compareTo(ChurchCRMRelease $b) { - if ($this->MAJOR < $b->MAJOR ) - { + if ($this->MAJOR < $b->MAJOR) { return -1; - } - elseif ($this->MAJOR > $b->MAJOR ) { + } elseif ($this->MAJOR > $b->MAJOR) { return 1; - } - elseif ($this->MAJOR == $b->MAJOR ) { + } elseif ($this->MAJOR == $b->MAJOR) { if ($this->MINOR < $b->MINOR) { return -1; - } - elseif ($this->MINOR > $b->MINOR) { + } elseif ($this->MINOR > $b->MINOR) { return 1; - } - elseif ($this->MINOR == $b->MINOR) { - if ($this->PATCH < $b->PATCH) - { + } elseif ($this->MINOR == $b->MINOR) { + if ($this->PATCH < $b->PATCH) { return -1; - } - else if ($this->PATCH > $b->PATCH) { + } elseif ($this->PATCH > $b->PATCH) { return 1; - } - else if($this->PATCH == $b->PATCH) { + } elseif ($this->PATCH == $b->PATCH) { return 0; } } @@ -56,8 +46,7 @@ public function compareTo(ChurchCRMRelease $b) { public function __toString() { - try - { + try { return (string) $this->MAJOR.".".$this->MINOR.".".$this->PATCH; } catch (\Exception $exception) @@ -69,7 +58,7 @@ public function __toString() public function getDownloadURL() { foreach ($this->rawRelease['assets'] as $asset) { if ($asset['name'] == "ChurchCRM-" . $this->rawRelease['name'] . ".zip") { - $url = $asset['browser_download_url']; + $url = $asset['browser_download_url']; } } return $url; diff --git a/src/Include/analyticstracking.php b/src/Include/analyticstracking.php index 35b88c22a8..c42d943253 100644 --- a/src/Include/analyticstracking.php +++ b/src/Include/analyticstracking.php @@ -27,6 +27,6 @@ diff --git a/src/SystemDBUpdate.php b/src/SystemDBUpdate.php index fa4079e45f..e0a2c27304 100644 --- a/src/SystemDBUpdate.php +++ b/src/SystemDBUpdate.php @@ -25,7 +25,7 @@ $logger->info("Complete database upgrade; redirecting to Main menu"); RedirectUtils::Redirect('Menu.php'); exit; - } catch (Exception $ex) { + } catch (\Exception $ex) { $errorMessage = $ex->getMessage(); $logger->error("Error updating database: " .$errorMessage, ['exception' => $ex]); } diff --git a/src/api/routes/people/people-family.php b/src/api/routes/people/people-family.php index 1284e35c0b..d739148c6a 100644 --- a/src/api/routes/people/people-family.php +++ b/src/api/routes/people/people-family.php @@ -76,7 +76,7 @@ try{ $family->sendVerifyEmail(); return $response->withStatus(200); - } catch (\Exception $e ) { + } catch (\Exception $e) { LoggerUtils::getAppLogger()->error($e->getMessage()); return $response->withStatus(500)->withJson(['message' => gettext("Error sending email(s)") . " - " . gettext("Please check logs for more information"), "trace" => $e->getMessage()]); } From ebc1e9879fd14e567bce3be280f3d05ffe9e93cd Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Thu, 26 Oct 2023 14:56:03 -0700 Subject: [PATCH 4/5] reverted --- src/ChurchCRM/Authentication/AuthenticationManager.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ChurchCRM/Authentication/AuthenticationManager.php b/src/ChurchCRM/Authentication/AuthenticationManager.php index 0103ac3ec7..673c5bd9cd 100644 --- a/src/ChurchCRM/Authentication/AuthenticationManager.php +++ b/src/ChurchCRM/Authentication/AuthenticationManager.php @@ -20,11 +20,7 @@ class AuthenticationManager // Currently, only local auth is implemented; hence the zero-indexed array elements. public static function GetAuthenticationProvider() { - if ( - isset($_SESSION) && - array_key_exists('AuthenticationProvider', $_SESSION) && - $_SESSION['AuthenticationProvider'] instanceof IAuthenticationProvider - ) { + if ( key_exists("AuthenticationProvider", $_SESSION) && $_SESSION['AuthenticationProvider'] instanceof IAuthenticationProvider) { return $_SESSION['AuthenticationProvider']; } else { From 6218bab7bf75e1da2953f3a8ed6829fbb927faa2 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Thu, 26 Oct 2023 15:00:41 -0700 Subject: [PATCH 5/5] Revert "ensure classes exist within namespace and fix types to inheritance errors" This reverts commit bd6043778fddaa47f3104b51301d22e861766482. --- .../Search/AddressSearchResultProvider.php | 2 +- .../CalendarEventSearchResultProvider.php | 2 +- .../Search/FamilySearchResultProvider.php | 4 +-- .../FinanceDepositSearchResultProvider.php | 2 +- .../FinancePaymentSearchResultProvider.php | 2 +- .../Search/GroupSearchResultProvider.php | 2 +- .../Search/PersonSearchResultProvider.php | 2 +- src/ChurchCRM/Search/SearchResultGroup.php | 19 +++++------ src/ChurchCRM/data/Country.php | 3 +- src/ChurchCRM/dto/ChurchCRMRelease.php | 33 ++++++++++++------- src/Include/analyticstracking.php | 2 +- src/SystemDBUpdate.php | 2 +- src/api/routes/people/people-family.php | 2 +- 13 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/ChurchCRM/Search/AddressSearchResultProvider.php b/src/ChurchCRM/Search/AddressSearchResultProvider.php index 8229594016..46bd6149f8 100644 --- a/src/ChurchCRM/Search/AddressSearchResultProvider.php +++ b/src/ChurchCRM/Search/AddressSearchResultProvider.php @@ -43,7 +43,7 @@ private function getPersonSearchResultsByPartialAddress(string $SearchQuery) { array_push($searchResults, new SearchResult("person-address-".$id, $address->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),$address->getViewURI())); } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } diff --git a/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php b/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php index 0c1aeac743..4a4c58648b 100644 --- a/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php +++ b/src/ChurchCRM/Search/CalendarEventSearchResultProvider.php @@ -41,7 +41,7 @@ private function getCalendarEventSearchResultsByPartialName(string $SearchQuery) array_push($searchResults, new SearchResult("event-name-".$id, $event->getTitle(),$event->getViewURI())); } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FamilySearchResultProvider.php b/src/ChurchCRM/Search/FamilySearchResultProvider.php index 3db46b336e..e1adb5cbed 100644 --- a/src/ChurchCRM/Search/FamilySearchResultProvider.php +++ b/src/ChurchCRM/Search/FamilySearchResultProvider.php @@ -51,7 +51,7 @@ private function getFamilySearchResultsByPartialName(string $SearchQuery) { } return $searchResults; - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } } @@ -74,7 +74,7 @@ private function getFamilySearchResultsByCustomProperties(string $SearchQuery) { $id++; array_push($searchResults, new SearchResult("family-custom-prop-".$id, $family->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),$family->getViewURI())); } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php b/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php index e71dad4bc6..bd0aa66b1f 100644 --- a/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php +++ b/src/ChurchCRM/Search/FinanceDepositSearchResultProvider.php @@ -45,7 +45,7 @@ private function getDepositSearchResults(string $SearchQuery) { array_push($searchResults, new SearchResult("finance-deposit-".$id, $Deposit['displayName'], $Deposit['uri'])); } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php b/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php index b1abb3750a..001dd71a36 100644 --- a/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php +++ b/src/ChurchCRM/Search/FinancePaymentSearchResultProvider.php @@ -83,7 +83,7 @@ private function getPaymentSearchResults(string $SearchQuery) { } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/GroupSearchResultProvider.php b/src/ChurchCRM/Search/GroupSearchResultProvider.php index cf2c29a1f1..53308beaaa 100644 --- a/src/ChurchCRM/Search/GroupSearchResultProvider.php +++ b/src/ChurchCRM/Search/GroupSearchResultProvider.php @@ -38,7 +38,7 @@ private function getPersonSearchResultsByPartialName(string $SearchQuery) { array_push($searchResults, new SearchResult("group-name-".$id, $group->getName(),$group->getViewURI())); } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/PersonSearchResultProvider.php b/src/ChurchCRM/Search/PersonSearchResultProvider.php index 6e2cf5dfba..809a5db738 100644 --- a/src/ChurchCRM/Search/PersonSearchResultProvider.php +++ b/src/ChurchCRM/Search/PersonSearchResultProvider.php @@ -45,7 +45,7 @@ private function getPersonSearchResultsByPartialName(string $SearchQuery) { array_push($searchResults, new SearchResult("person-name-".$id, $person->getFullName(),$person->getViewURI())); } } - } catch (\Exception $e) { + } catch (Exception $e) { LoggerUtils::getAppLogger()->warning($e->getMessage()); } return $searchResults; diff --git a/src/ChurchCRM/Search/SearchResultGroup.php b/src/ChurchCRM/Search/SearchResultGroup.php index 8b3955bb3a..7ba9160945 100644 --- a/src/ChurchCRM/Search/SearchResultGroup.php +++ b/src/ChurchCRM/Search/SearchResultGroup.php @@ -2,22 +2,19 @@ namespace ChurchCRM\Search; -class SearchResultGroup implements \JsonSerializable -{ - private string $groupName; - private array $results; +class SearchResultGroup implements \JsonSerializable { + public $groupName; + public $results; - public function __construct(string $groupName, array $results) - { + public function __construct(string $groupName, array $results) { $this->groupName = $groupName; $this->results = $results; } - public function jsonSerialize(): array - { - return [ - 'text' => $this->groupName, - 'children' => $this->results, + public function jsonSerialize() { + return @[ + "text" => $this->groupName, + "children" => $this->results ]; } } \ No newline at end of file diff --git a/src/ChurchCRM/data/Country.php b/src/ChurchCRM/data/Country.php index b28ae865fe..d996e183ed 100644 --- a/src/ChurchCRM/data/Country.php +++ b/src/ChurchCRM/data/Country.php @@ -5,7 +5,7 @@ class Country implements \JsonSerializable { private string $countryCode; private string $countryName; - private ?string $countryNameYasumi = null; + private ?string $countryNameYasumi; public function __construct(string $CountryCode, string $CountryName, string $CountryNameYasumi = null) { @@ -29,7 +29,6 @@ public function getCountryNameYasumi(): ?string return $this->countryNameYasumi; } - public function jsonSerialize(): array public function jsonSerialize(): array { return [ diff --git a/src/ChurchCRM/dto/ChurchCRMRelease.php b/src/ChurchCRM/dto/ChurchCRMRelease.php index 38937fd8b9..cfb3f55d2e 100644 --- a/src/ChurchCRM/dto/ChurchCRMRelease.php +++ b/src/ChurchCRM/dto/ChurchCRMRelease.php @@ -1,7 +1,9 @@ rawRelease = $releaseArray; $versions = explode(".",$releaseArray["name"]); $this->MAJOR = $versions[0]; @@ -23,21 +25,29 @@ public function equals(ChurchCRMRelease $b) { } public function compareTo(ChurchCRMRelease $b) { - if ($this->MAJOR < $b->MAJOR) { + if ($this->MAJOR < $b->MAJOR ) + { return -1; - } elseif ($this->MAJOR > $b->MAJOR) { + } + elseif ($this->MAJOR > $b->MAJOR ) { return 1; - } elseif ($this->MAJOR == $b->MAJOR) { + } + elseif ($this->MAJOR == $b->MAJOR ) { if ($this->MINOR < $b->MINOR) { return -1; - } elseif ($this->MINOR > $b->MINOR) { + } + elseif ($this->MINOR > $b->MINOR) { return 1; - } elseif ($this->MINOR == $b->MINOR) { - if ($this->PATCH < $b->PATCH) { + } + elseif ($this->MINOR == $b->MINOR) { + if ($this->PATCH < $b->PATCH) + { return -1; - } elseif ($this->PATCH > $b->PATCH) { + } + else if ($this->PATCH > $b->PATCH) { return 1; - } elseif ($this->PATCH == $b->PATCH) { + } + else if($this->PATCH == $b->PATCH) { return 0; } } @@ -46,7 +56,8 @@ public function compareTo(ChurchCRMRelease $b) { public function __toString() { - try { + try + { return (string) $this->MAJOR.".".$this->MINOR.".".$this->PATCH; } catch (\Exception $exception) @@ -58,7 +69,7 @@ public function __toString() public function getDownloadURL() { foreach ($this->rawRelease['assets'] as $asset) { if ($asset['name'] == "ChurchCRM-" . $this->rawRelease['name'] . ".zip") { - $url = $asset['browser_download_url']; + $url = $asset['browser_download_url']; } } return $url; diff --git a/src/Include/analyticstracking.php b/src/Include/analyticstracking.php index c42d943253..35b88c22a8 100644 --- a/src/Include/analyticstracking.php +++ b/src/Include/analyticstracking.php @@ -27,6 +27,6 @@ diff --git a/src/SystemDBUpdate.php b/src/SystemDBUpdate.php index e0a2c27304..fa4079e45f 100644 --- a/src/SystemDBUpdate.php +++ b/src/SystemDBUpdate.php @@ -25,7 +25,7 @@ $logger->info("Complete database upgrade; redirecting to Main menu"); RedirectUtils::Redirect('Menu.php'); exit; - } catch (\Exception $ex) { + } catch (Exception $ex) { $errorMessage = $ex->getMessage(); $logger->error("Error updating database: " .$errorMessage, ['exception' => $ex]); } diff --git a/src/api/routes/people/people-family.php b/src/api/routes/people/people-family.php index d739148c6a..1284e35c0b 100644 --- a/src/api/routes/people/people-family.php +++ b/src/api/routes/people/people-family.php @@ -76,7 +76,7 @@ try{ $family->sendVerifyEmail(); return $response->withStatus(200); - } catch (\Exception $e) { + } catch (\Exception $e ) { LoggerUtils::getAppLogger()->error($e->getMessage()); return $response->withStatus(500)->withJson(['message' => gettext("Error sending email(s)") . " - " . gettext("Please check logs for more information"), "trace" => $e->getMessage()]); }