diff --git a/src/CartToEvent.php b/src/CartToEvent.php index 1c77ab709f..57e84d5f08 100644 --- a/src/CartToEvent.php +++ b/src/CartToEvent.php @@ -30,10 +30,8 @@ // Was the form submitted? if (isset($_POST['Submit']) && count($_SESSION['aPeopleCart']) > 0 && isset($_POST['EventID'])) { - // Get the PersonID $iEventID = InputUtils::legacyFilterInput($_POST['EventID'], 'int'); - // Loop through the session array $iCount = 0; foreach ($_SESSION['aPeopleCart'] as $element) { // Enter ID into event @@ -54,7 +52,7 @@ require 'Include/Header.php'; if (count($_SESSION['aPeopleCart']) > 0) { - $sSQL = 'SELECT * FROM events_event'; + $sSQL = 'SELECT event_id, event_title FROM events_event'; $rsEvents = RunQuery($sSQL); ?>

:

@@ -74,8 +72,7 @@ // Create the group select drop-down echo ''; ?> diff --git a/src/ChurchCRM/Service/TaskService.php b/src/ChurchCRM/Service/TaskService.php index 1e5fdf0c64..f7b4e19ba3 100644 --- a/src/ChurchCRM/Service/TaskService.php +++ b/src/ChurchCRM/Service/TaskService.php @@ -26,9 +26,9 @@ class TaskService { /** - * @var ObjectCollection|TaskInterface[] + * @var TaskInterface[] */ - private $taskClasses; + private array $taskClasses; private array $notificationClasses = [ // new LatestReleaseTask() ]; @@ -60,10 +60,12 @@ public function getCurrentUserTasks(): array $tasks = []; foreach ($this->taskClasses as $taskClass) { if ($taskClass->isActive() && (!$taskClass->isAdmin() || ($taskClass->isAdmin() && AuthenticationManager::getCurrentUser()->isAdmin()))) { - $tasks[] = ['title' => $taskClass->getTitle(), + $tasks[] = [ + 'title' => $taskClass->getTitle(), 'link' => $taskClass->getLink(), 'admin' => $taskClass->isAdmin(), - 'desc' => $taskClass->getDesc()]; + 'desc' => $taskClass->getDesc() + ]; } } @@ -75,7 +77,7 @@ public function getTaskNotifications(): array $tasks = []; foreach ($this->notificationClasses as $taskClass) { if ($taskClass->isActive()) { - $tasks[] = new UiNotification($taskClass->getTitle(), 'wrench', $taskClass->getLink(), $taskClass->getDesc(), $taskClass->isAdmin() ? 'warning' : 'info', '12000', 'bottom', 'left'); + $tasks[] = new UiNotification($taskClass->getTitle(), 'wrench', $taskClass->getLink(), $taskClass->getDesc(), $taskClass->isAdmin() ? 'warning' : 'info', 12000, 'bottom', 'left'); } } diff --git a/src/ChurchCRM/dto/Cart.php b/src/ChurchCRM/dto/Cart.php index 1fc0cf6524..b197dc9518 100644 --- a/src/ChurchCRM/dto/Cart.php +++ b/src/ChurchCRM/dto/Cart.php @@ -22,7 +22,7 @@ public static function addPerson($PersonID): void if (!is_numeric($PersonID)) { throw new \Exception(gettext('PersonID for Cart must be numeric'), 400); } - if ($PersonID !== null && !in_array($PersonID, $_SESSION['aPeopleCart'], false)) { + if (!in_array($PersonID, $_SESSION['aPeopleCart'], false)) { $_SESSION['aPeopleCart'][] = (int)$PersonID; } } diff --git a/src/ChurchCRM/dto/ChurchCRMRelease.php b/src/ChurchCRM/dto/ChurchCRMRelease.php index c073b0a23e..f1607e04f0 100644 --- a/src/ChurchCRM/dto/ChurchCRMRelease.php +++ b/src/ChurchCRM/dto/ChurchCRMRelease.php @@ -4,18 +4,9 @@ class ChurchCRMRelease { - /** - * @var string - */ - public $MAJOR; - /** - * @var string - */ - public $MINOR; - /** - * @var string - */ - public $PATCH; + public string $MAJOR; + public string $MINOR; + public string $PATCH; private array $rawRelease; @@ -30,10 +21,10 @@ public function __construct(array $releaseArray) public function equals(ChurchCRMRelease $b): bool { - return $this->MAJOR == $b->MAJOR && $this->MINOR == $b->MINOR && $this->PATCH == $b->PATCH; + return $this->MAJOR === $b->MAJOR && $this->MINOR === $b->MINOR && $this->PATCH === $b->PATCH; } - public function compareTo(ChurchCRMRelease $b) + public function compareTo(ChurchCRMRelease $b): int { if ($this->MAJOR < $b->MAJOR) { return -1; @@ -59,21 +50,21 @@ public function compareTo(ChurchCRMRelease $b) public function __toString(): string { try { - return (string) $this->MAJOR . '.' . $this->MINOR . '.' . $this->PATCH; + return $this->MAJOR . '.' . $this->MINOR . '.' . $this->PATCH; } catch (\Exception $exception) { return ''; } } - public function getDownloadURL() + public function getDownloadURL(): string { foreach ($this->rawRelease['assets'] as $asset) { if ($asset['name'] == 'ChurchCRM-' . $this->rawRelease['name'] . '.zip') { - $url = $asset['browser_download_url']; + return $asset['browser_download_url']; } } - return $url; + throw new \Exception('download url not found!'); } public function getReleaseNotes(): string @@ -85,6 +76,6 @@ public function isPreRelease(): bool { // yeah, it's a boolean in the JSON, but // let's check it to be sure this function returns a boolean. - return $this->rawRelease['prerelease'] == true; + return (bool) $this->rawRelease['prerelease'] === true; } } diff --git a/src/ChurchCRM/dto/Notification/UiNotification.php b/src/ChurchCRM/dto/Notification/UiNotification.php index d99e555ee8..b55e91bf1e 100644 --- a/src/ChurchCRM/dto/Notification/UiNotification.php +++ b/src/ChurchCRM/dto/Notification/UiNotification.php @@ -6,29 +6,25 @@ class UiNotification implements JsonSerializable { - private $title; - private $message; - private $url; - private $type; - private $icon; - private $delay; - private $placement; - private $align; + private string $title; + private string $message; + private string $url; + private string $type; + private string $icon; + private int $delay; + private string $placement; + private string $align; - /** - * UiNotification constructor. - * - * @param $title - * @param $message - * @param $url - * @param $type - * @param $icon - * @param $delay - * @param $placement - * @param $align - */ - public function __construct($title, $icon, $url = '', $message = '', $type = 'info', $delay = 4000, $placement = 'top', $align = 'right') - { + public function __construct( + string $title, + string $icon, + string $url = '', + string $message = '', + string $type = 'info', + int $delay = 4000, + string $placement = 'top', + string $align = 'right' + ) { $this->title = $title; $this->message = $message; $this->url = $url; @@ -39,66 +35,42 @@ public function __construct($title, $icon, $url = '', $message = '', $type = 'in $this->align = $align; } - /** - * @return mixed - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * @return string - */ - public function getMessage() + public function getMessage(): string { return $this->message; } - /** - * @return string - */ - public function getUrl() + public function getUrl(): string { return $this->url; } - /** - * @return string - */ - public function getType() + public function getType(): string { return $this->type; } - /** - * @return mixed - */ - public function getIcon() + public function getIcon(): string { return $this->icon; } - /** - * @return int - */ - public function getDelay() + public function getDelay(): int { return $this->delay; } - /** - * @return string - */ - public function getPlacement() + public function getPlacement(): string { return $this->placement; } - /** - * @return string - */ - public function getAlign() + public function getAlign(): string { return $this->align; } diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index 177a7841f4..b22fd43af8 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -11,7 +11,7 @@ class SystemConfig { /** - * @var Config[] + * @var Config[]|null */ private static ?array $configs = null; diff --git a/src/ChurchCRM/model/ChurchCRM/Person.php b/src/ChurchCRM/model/ChurchCRM/Person.php index a54824035a..2419b3a4e7 100644 --- a/src/ChurchCRM/model/ChurchCRM/Person.php +++ b/src/ChurchCRM/model/ChurchCRM/Person.php @@ -628,7 +628,7 @@ public function getNumericCellPhone(): string return '1' . preg_replace('/[^\.0-9]/', '', $this->getCellPhone()); } - public function postSave(ConnectionInterface $con = null) + public function postSave(ConnectionInterface $con = null): void { $this->getPhoto()->refresh(); diff --git a/src/UserEditor.php b/src/UserEditor.php index ff540a1e72..9af60c0fcc 100644 --- a/src/UserEditor.php +++ b/src/UserEditor.php @@ -32,8 +32,6 @@ use ChurchCRM\Utils\RedirectUtils; use Propel\Runtime\ActiveQuery\Criteria; -; - // Security: User must be an Admin to access this page. // Otherwise re-direct to the main menu. if (!AuthenticationManager::getCurrentUser()->isAdmin()) { diff --git a/src/api/routes/system/system.php b/src/api/routes/system/system.php index 947d0c660f..56b4fe1ef5 100644 --- a/src/api/routes/system/system.php +++ b/src/api/routes/system/system.php @@ -30,7 +30,7 @@ function getUiNotificationAPI(Request $request, Response $response, array $args) } $notifications = []; foreach (NotificationService::getNotifications() as $notification) { - $uiNotification = new UiNotification($notification->title, 'bell', $notification->link, '', 'danger', '8000', 'bottom', 'left'); + $uiNotification = new UiNotification($notification->getTitle(), 'bell', $notification->link, '', 'danger', 8000, 'bottom', 'left'); $notifications[] = $uiNotification; }