1 | <?php |
||
13 | abstract class Enum extends BaseEnum implements EnumInterface, LocalizedEnum |
||
14 | { |
||
15 | /** |
||
16 | * Get the enum as an collection formatted for a select. |
||
17 | * |
||
18 | * @return Collection |
||
19 | */ |
||
20 | public static function toSelectCollection(): Collection |
||
31 | |||
32 | /** |
||
33 | * Get the description for an enum value. |
||
34 | * |
||
35 | * @param int|string $value |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | public static function getDescription($value): string |
||
45 | |||
46 | /** |
||
47 | * Get the localized description if localization is enabled |
||
48 | * for the enum and if they key exists in the lang file. |
||
49 | * |
||
50 | * @param int|string $value |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | protected static function getLocalizedDescription($value): ?string |
||
69 | |||
70 | /** |
||
71 | * Get the default localization key. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public static function getLocalizationKey(): string |
||
79 | |||
80 | /** |
||
81 | * @param $value |
||
82 | * @param string $message |
||
83 | * |
||
84 | * @throws InvalidEnumValueException |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | public static function hasValueOrFail($value, string $message = '') |
||
96 | |||
97 | /** |
||
98 | * Check that the enum contains all values of the array. |
||
99 | * |
||
100 | * @param array $values |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | public static function containsValues(array $values) |
||
114 | |||
115 | /** |
||
116 | * Check that the enum contains all values of the array and throws an exception, if not. |
||
117 | * |
||
118 | * @param array $values |
||
119 | * @param string $message |
||
120 | * |
||
121 | * @throws InvalidEnumValueException |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public static function containsValuesOrFail(array $values, string $message = '') |
||
133 | } |
||
134 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.