mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
23 lines
573 B
PHP
23 lines
573 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Flasher\Prime\Exception;
|
|
|
|
final class CriteriaNotRegisteredException extends \Exception
|
|
{
|
|
/**
|
|
* @param string[] $availableCriteria
|
|
*/
|
|
public static function create(string $alias, array $availableCriteria = []): self
|
|
{
|
|
$message = \sprintf('Criteria "%s" not found, did you forget to register it?', $alias);
|
|
|
|
if ([] !== $availableCriteria) {
|
|
$message .= \sprintf(' Available criteria: [%s]', implode(', ', $availableCriteria));
|
|
}
|
|
|
|
return new self($message);
|
|
}
|
|
}
|