From 323abb1cf21f3bd3a65e5a74a4e8b09caa36cbae Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 25 Jun 2024 18:43:31 +0200 Subject: [PATCH] Move up method in source --- .../src/Framework/Exceptions/ParseException.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/framework/src/Framework/Exceptions/ParseException.php b/packages/framework/src/Framework/Exceptions/ParseException.php index 3452b493648..753cb870780 100644 --- a/packages/framework/src/Framework/Exceptions/ParseException.php +++ b/packages/framework/src/Framework/Exceptions/ParseException.php @@ -23,6 +23,11 @@ public function __construct(string $file = '', ?Throwable $previous = null) parent::__construct($this->formatMessage($file, $previous), previous: $previous); } + protected function formatMessage(string $file, ?Throwable $previous): string + { + return rtrim(sprintf("Invalid %s in file: '%s' %s", $this->getTypeLabel($file), $file, $this->getContext($previous))); + } + protected function getTypeLabel(string $file): string { return match (Arr::last(explode('.', $file))) { @@ -37,9 +42,4 @@ protected function getContext(?Throwable $previous): string { return ($previous && $previous->getMessage()) ? sprintf('(%s)', rtrim($previous->getMessage(), '.')) : ''; } - - protected function formatMessage(string $file, ?Throwable $previous): string - { - return rtrim(sprintf("Invalid %s in file: '%s' %s", $this->getTypeLabel($file), $file, $this->getContext($previous))); - } }