Lines 100.00% 6 / 6
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
GitDeployConfig 100.00% 6 / 6 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 fromSection 100.00% 5 / 5 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Config;
6
7use Stewart\Contracts\Time\Duration;
8use Stewart\Runtime\Exception\ConfigurationException;
9
10final readonly class GitDeployConfig
11{
12    public function __construct(
13        public OptionalDuration $poll,
14        public Duration $prepareTimeout,
15    ) {}
16
17    /** @throws ConfigurationException */
18    public static function fromSection(ConfigSection $git): self
19    {
20        $oneSecond = Duration::seconds(1);
21
22        return new self(
23            poll: $git->readOptionalDuration('poll', $oneSecond),
24            prepareTimeout: $git->readDuration('prepare_timeout', $oneSecond),
25        );
26    }
27}