Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Use class name instead of self #337

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading