for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Arcanedev\LaravelImpersonator\Exceptions;
use Arcanedev\LaravelImpersonator\Contracts\Impersonatable;
/**
* Class ImpersonationException
*
* @package Arcanedev\LaravelImpersonator\Exceptions
* @author ARCANEDEV <[email protected]>
*/
class ImpersonationException extends \Exception
{
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
* Make a new exception.
* @param string $message
* @return static
public static function make(string $message): self
return new static($message);
}
* Make an exception when the impersonater and impersonated are same person.
public static function selfImpersonation(): self
return static::make('The impersonater & impersonated with must be different.');
* Make an exception when the impersonater cannot (or not allowed) impersonate.
* @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonater
public static function cannotImpersonate(Impersonatable $impersonater): self
return static::make(
"The impersonater with `{$impersonater->getAuthIdentifierName()}`=[{$impersonater->getAuthIdentifier()}] doesn't have the ability to impersonate."
);
* Make an exception when the impersonated cannot be impersonated.
* @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonated
public static function cannotBeImpersonated(Impersonatable $impersonated)
"The impersonated with `{$impersonated->getAuthIdentifierName()}`=[{$impersonated->getAuthIdentifier()}] cannot be impersonated."