Lines
100.00%
7 / 7
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% | 6 / 6 | 100.00% | 1 / 1 | 1 | ||
| 11 | final readonly class ExposeConfig | |
| 12 | { | |
| 13 | private const int LONGEST_COMMAND_TIMEOUT_THE_COMPONENT_ACCEPTS_SECONDS = 300; | |
| 14 | ||
| 15 | public function __construct( | |
| 16 | public ComponentInstance $instance, | |
| 17 | public Duration $commandTimeout, | |
| 18 | public bool $prune = true, | |
| 19 | public bool $enabled = true, | |
| 20 | ) {} | |
| 21 | ||
| 22 | /** @throws ConfigurationException */ | |
| 23 | public static function fromSection(ConfigSection $expose): self | |
| 24 | { | |
| 25 | return new self( | |
| 26 | $expose->readParsedValue('instance', ComponentInstance::parse(...)), | |
| 27 | $expose->readDuration('command_timeout', Duration::milliseconds(1), Duration::seconds(self::LONGEST_COMMAND_TIMEOUT_THE_COMPONENT_ACCEPTS_SECONDS)), | |
| 28 | $expose->readBool('prune'), | |
| 29 | $expose->readBool('enabled'), | |
| 30 | ); | |
| 31 | } | |
| 32 | } |