Lines
100.00%
6 / 6
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% | 5 / 5 | 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 | ) {} | |
| 20 | ||
| 21 | /** @throws ConfigurationException */ | |
| 22 | public static function fromSection(ConfigSection $expose): self | |
| 23 | { | |
| 24 | return new self( | |
| 25 | $expose->readParsedValue('instance', ComponentInstance::parse(...)), | |
| 26 | $expose->readDuration('command_timeout', Duration::milliseconds(1), Duration::seconds(self::LONGEST_COMMAND_TIMEOUT_THE_COMPONENT_ACCEPTS_SECONDS)), | |
| 27 | $expose->readBool('prune'), | |
| 28 | ); | |
| 29 | } | |
| 30 | } |