Skip to content

Commit

Permalink
ENH Use class name instead of self
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jun 5, 2024
1 parent b26fdaf commit 4cda1e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/PageTypes/DatedUpdateHolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public static function ExtractMonths(
])
->execute();
} catch (DatabaseException $e) {
self::handleInvalidDateFormat($e);
DatedUpdateHolder::handleInvalidDateFormat($e);
}

$years = [];
Expand Down
10 changes: 5 additions & 5 deletions src/PageTypes/DatedUpdateHolderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
));
Expand All @@ -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.'
));
Expand All @@ -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.'
));
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4cda1e2

Please sign in to comment.