| 1 | <?php |
||
| 5 | trait CustomMessagesTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Return custom error message or a default one. |
||
| 9 | * |
||
| 10 | * @param string|null $message |
||
| 11 | * @param string $method |
||
| 12 | * |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | protected function makeMessage(string $message = null, string $method): string |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Fetch method name. |
||
| 22 | * |
||
| 23 | * @param string $method |
||
| 24 | * |
||
| 25 | * @return string |
||
| 26 | */ |
||
| 27 | protected function getMethod(string $method): string |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Return error message for checker. |
||
| 40 | * |
||
| 41 | * @param string $method |
||
| 42 | * |
||
| 43 | * @see \Spiral\Validation\CheckerInterface::getMessage() |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | abstract public function getMessage(string $method): string; |
||
| 48 | } |