fatcode/enum

View on GitHub
src/Exception/EnumException.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php declare(strict_types=1);

namespace FatCode\Exception;

use UnexpectedValueException;

final class EnumException extends UnexpectedValueException
{
    public static function forInvalidValue(string $enumClass, $value) : self
    {
        return new self("{$enumClass} does not define `{$value}` value as a valid value.");
    }

    public static function forInvalidKey(string $enumClass, string $key) : self
    {
        return new self("{$enumClass} does not define `{$key}` constant.");
    }
}