@@ 15-44 (lines=30) @@ | ||
12 | use function React\Promise\resolve; |
|
13 | use function WyriHaximus\React\futureFunctionPromise; |
|
14 | ||
15 | final class CachesHandler |
|
16 | { |
|
17 | /** |
|
18 | * @var FetchAndHydrateService |
|
19 | */ |
|
20 | private $service; |
|
21 | ||
22 | /** |
|
23 | * @param FetchAndIterateService $service |
|
24 | */ |
|
25 | public function __construct(FetchAndIterateService $service) |
|
26 | { |
|
27 | $this->service = $service; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * Fetch the given repository and hydrate it |
|
32 | * |
|
33 | * @param CachesCommand $command |
|
34 | * @return PromiseInterface |
|
35 | */ |
|
36 | public function handle(CachesCommand $command): PromiseInterface |
|
37 | { |
|
38 | return $this->service->handle( |
|
39 | 'repos/' . (string)$command->getRepositoryId() . '/caches', |
|
40 | 'caches', |
|
41 | CacheInterface::HYDRATE_CLASS |
|
42 | ); |
|
43 | } |
|
44 | } |
|
45 |
@@ 13-42 (lines=30) @@ | ||
10 | use function React\Promise\resolve; |
|
11 | use function WyriHaximus\React\futureFunctionPromise; |
|
12 | ||
13 | final class VarsHandler |
|
14 | { |
|
15 | /** |
|
16 | * @var FetchAndHydrateService |
|
17 | */ |
|
18 | private $service; |
|
19 | ||
20 | /** |
|
21 | * @param FetchAndIterateService $service |
|
22 | */ |
|
23 | public function __construct(FetchAndIterateService $service) |
|
24 | { |
|
25 | $this->service = $service; |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Fetch the given repository and hydrate it |
|
30 | * |
|
31 | * @param VarsCommand $command |
|
32 | * @return PromiseInterface |
|
33 | */ |
|
34 | public function handle(VarsCommand $command): PromiseInterface |
|
35 | { |
|
36 | return $this->service->handle( |
|
37 | 'settings/env_vars?repository_id=' . (string)$command->getRepositoryId(), |
|
38 | 'env_vars', |
|
39 | EnvironmentVariableInterface::HYDRATE_CLASS |
|
40 | ); |
|
41 | } |
|
42 | } |
|
43 |