Lines 0.00% 0 / 4
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
BrokerError 0.00% 0 / 4 0.00% 0 / 1 20 0.00% 0 / 1
 messageTemplate 0.00% 0 / 4 0.00% 0 / 1 20
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Exception;
6
7use Stewart\Contracts\Exception\ExceptionReason;
8
9enum BrokerError: string implements ExceptionReason
10{
11    case NoWorkersStarted = 'no_workers_started';
12    case WorkerSpawnTimedOut = 'worker_spawn_timed_out';
13    case ReloadConfigChanged = 'reload_config_changed';
14
15    public function messageTemplate(): string
16    {
17        return match ($this) {
18            self::NoWorkersStarted => 'None of {workers} workers could be started.',
19            self::WorkerSpawnTimedOut => 'Worker {worker} did not connect within {timeout}.',
20            self::ReloadConfigChanged => '{path} changed while the reload checked it, so nothing was applied; reload again.',
21        };
22    }
23}