| 1 | <?php |
||
| 15 | class ErrorMessageResolver implements ErrorMessageResolverContract |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * A serivce for resolving messages from language files. |
||
| 19 | * |
||
| 20 | * @var \Illuminate\Contracts\Translation\Translator |
||
| 21 | */ |
||
| 22 | protected $translator; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Construct the resolver class. |
||
| 26 | * |
||
| 27 | * @param \Illuminate\Contracts\Translation\Translator $translator |
||
| 28 | */ |
||
| 29 | public function __construct(Translator $translator) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Resolve a message from the given error code. |
||
| 36 | * |
||
| 37 | * @param string $errorCode |
||
| 38 | * @return string|null |
||
| 39 | */ |
||
| 40 | public function resolve(string $errorCode) |
||
| 48 | } |
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.