Skip to content

Commit

Permalink
Dev: Define the exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
ping-yee committed Aug 4, 2023
1 parent adbfbf7 commit 3eb083c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 12 additions & 2 deletions system/Pager/Exceptions/PagerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@

class PagerException extends FrameworkException
{
public static function forInvalidTemplate(?string $template = null): self
/**
* Throws when the template is invalid.
*
* @return static
*/
public static function forInvalidTemplate(?string $template = null)
{
return new static(lang('Pager.invalidTemplate', [$template]));
}

public static function forInvalidPaginationGroup(?string $group = null): self
/**
* Throws when the group is invalid.
*
* @return static
*/
public static function forInvalidPaginationGroup(?string $group = null)
{
return new static(lang('Pager.invalidPaginationGroup', [$group]));
}
Expand Down
12 changes: 9 additions & 3 deletions system/Publisher/Exceptions/PublisherException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,30 @@ class PublisherException extends FrameworkException
*
* @param string $from The source file
* @param string $to The destination file
*
* @return static
*/
public static function forCollision(string $from, string $to): self
public static function forCollision(string $from, string $to)
{
return new static(lang('Publisher.collision', [filetype($to), $from, $to]));
}

/**
* Throws when given a destination that is not in the list of allowed directories.
*
* @return static
*/
public static function forDestinationNotAllowed(string $destination): self
public static function forDestinationNotAllowed(string $destination)
{
return new static(lang('Publisher.destinationNotAllowed', [$destination]));
}

/**
* Throws when a file fails to match the allowed pattern for its destination.
*
* @return static
*/
public static function forFileNotAllowed(string $file, string $directory, string $pattern): self
public static function forFileNotAllowed(string $file, string $directory, string $pattern)
{
return new static(lang('Publisher.fileNotAllowed', [$file, $directory, $pattern]));
}
Expand Down

0 comments on commit 3eb083c

Please sign in to comment.