Skip to content

Commit

Permalink
Move up method in source
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jun 25, 2024
1 parent b2d3282 commit 323abb1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/framework/src/Framework/Exceptions/ParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand All @@ -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)));
}
}

0 comments on commit 323abb1

Please sign in to comment.