| @@ 14-43 (lines=30) @@ | ||
| 11 | use function React\Promise\resolve; |
|
| 12 | use function WyriHaximus\React\futureFunctionPromise; |
|
| 13 | ||
| 14 | final class BranchesHandler |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @var FetchAndHydrateService |
|
| 18 | */ |
|
| 19 | private $service; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @param FetchAndIterateService $service |
|
| 23 | */ |
|
| 24 | public function __construct(FetchAndIterateService $service) |
|
| 25 | { |
|
| 26 | $this->service = $service; |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * Fetch the given repository and hydrate it |
|
| 31 | * |
|
| 32 | * @param BranchesCommand $command |
|
| 33 | * @return PromiseInterface |
|
| 34 | */ |
|
| 35 | public function handle(BranchesCommand $command): PromiseInterface |
|
| 36 | { |
|
| 37 | return $this->service->handle( |
|
| 38 | 'repos/' . (string)$command->getRepositoryId() . '/branches', |
|
| 39 | 'branches', |
|
| 40 | BranchInterface::HYDRATE_CLASS |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 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 | ||