Lines
100.00%
13 / 13
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| fromSection | 100.00% | 12 / 12 | 100.00% | 1 / 1 | 3 | ||
| 12 | final readonly class AppOverride | |
| 13 | { | |
| 14 | /** @param array<string, mixed> $options */ | |
| 15 | public function __construct( | |
| 16 | public AppId $id, | |
| 17 | public bool $enabled, | |
| 18 | public bool $paused, | |
| 19 | public ?int $worker, | |
| 20 | public array $options, | |
| 21 | public ?LogLevel $logLevel = null, | |
| 22 | public bool $trace = false, | |
| 23 | public ?string $class = null, | |
| 24 | ) {} | |
| 25 | ||
| 26 | /** | |
| 27 | * @throws ConfigurationException | |
| 28 | * @throws IdentifierException | |
| 29 | */ | |
| 30 | public static function fromSection(ConfigSection $app, string $id): self | |
| 31 | { | |
| 32 | $logLevel = $app->findString('log_level'); | |
| 33 | $class = ltrim($app->findString('class') ?? '', '\\'); | |
| 34 | ||
| 35 | return new self( | |
| 36 | id: new AppId($id), | |
| 37 | enabled: $app->readBool('enabled'), | |
| 38 | paused: $app->readBool('paused'), | |
| 39 | worker: $app->findInt('worker'), | |
| 40 | options: $app->readMap('options'), | |
| 41 | logLevel: $logLevel === null ? null : LogLevel::from($logLevel), | |
| 42 | trace: $app->readBool('trace'), | |
| 43 | class: $class === '' ? null : $class, | |
| 44 | ); | |
| 45 | } | |
| 46 | } |