From cfcd4540acf0784b8c21b779b43f8a28873fd0cd Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 5 Jun 2024 15:11:57 +1200 Subject: [PATCH] ENH Use class name instead of self --- src/PageTypes/DatedUpdateHolder.php | 4 ++-- src/PageTypes/DatedUpdateHolderController.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PageTypes/DatedUpdateHolder.php b/src/PageTypes/DatedUpdateHolder.php index 2751752..4f36861 100644 --- a/src/PageTypes/DatedUpdateHolder.php +++ b/src/PageTypes/DatedUpdateHolder.php @@ -152,7 +152,7 @@ public static function AllUpdates( // Try running query inside try/catch block to handle any invalid date format $items->dataQuery()->execute(); } catch (DatabaseException $e) { - self::handleInvalidDateFormat($e); + DatedUpdateHolder::handleInvalidDateFormat($e); // Ensure invalid SQL does not get run again $items = $className::get()->limit(null); } @@ -213,7 +213,7 @@ public static function ExtractMonths( ]) ->execute(); } catch (DatabaseException $e) { - self::handleInvalidDateFormat($e); + DatedUpdateHolder::handleInvalidDateFormat($e); } $years = []; diff --git a/src/PageTypes/DatedUpdateHolderController.php b/src/PageTypes/DatedUpdateHolderController.php index d721ffa..bf7be69 100644 --- a/src/PageTypes/DatedUpdateHolderController.php +++ b/src/PageTypes/DatedUpdateHolderController.php @@ -177,7 +177,7 @@ public function parseParams($produceErrorMessages = true) } } catch (InvalidArgumentException $e) { if ($produceErrorMessages) { - $this->getRequest()->getSession()->set(self::TEMP_FORM_MESSAGE, _t( + $this->getRequest()->getSession()->set(DatedUpdateHolderController::TEMP_FORM_MESSAGE, _t( __CLASS__ . '.InvalidDateFormat', 'Dates must be in "y-MM-dd" format.' )); @@ -200,7 +200,7 @@ public function parseParams($produceErrorMessages = true) list($to, $from) = [$from, $to]; if ($produceErrorMessages) { - $this->getRequest()->getSession()->set(self::TEMP_FORM_MESSAGE, _t( + $this->getRequest()->getSession()->set(DatedUpdateHolderController::TEMP_FORM_MESSAGE, _t( __CLASS__ . '.FilterAppliedMessage', 'Filter has been applied with the dates reversed.' )); @@ -210,7 +210,7 @@ public function parseParams($produceErrorMessages = true) // Notify the user that filtering by single date is taking place. if (isset($from) && !isset($to)) { if ($produceErrorMessages) { - $this->getRequest()->getSession()->set(self::TEMP_FORM_MESSAGE, _t( + $this->getRequest()->getSession()->set(DatedUpdateHolderController::TEMP_FORM_MESSAGE, _t( __CLASS__ . '.DateRangeFilterMessage', 'Filtered by a single date.' )); @@ -347,9 +347,9 @@ public function DateRangeForm() $form->setFormMethod('get'); // Add any locally stored form messages before returning - if ($formMessage = $this->getRequest()->getSession()->get(self::TEMP_FORM_MESSAGE)) { + if ($formMessage = $this->getRequest()->getSession()->get(DatedUpdateHolderController::TEMP_FORM_MESSAGE)) { $form->setMessage($formMessage, ValidationResult::TYPE_WARNING); - $this->getRequest()->getSession()->clear(self::TEMP_FORM_MESSAGE); + $this->getRequest()->getSession()->clear(DatedUpdateHolderController::TEMP_FORM_MESSAGE); } return $form;