| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class SplitRepositoryInitializer extends AbstractOperation implements SplitRepositoryInitializerInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @param string $repositoryName |
||
| 12 | * |
||
| 13 | * @return \Dandelion\Operation\SplitRepositoryInitializerInterface |
||
| 14 | */ |
||
| 15 | public function executeForSingleRepository(string $repositoryName): SplitRepositoryInitializerInterface |
||
| 16 | { |
||
| 17 | $configuration = $this->configurationLoader->load(); |
||
| 18 | $repositories = $configuration->getRepositories(); |
||
| 19 | |||
| 20 | if (!$repositories->offsetExists($repositoryName)) { |
||
| 21 | throw new RepositoryNotFoundException(sprintf('Could not find repository "%s".', $repositoryName)); |
||
| 22 | } |
||
| 23 | |||
| 24 | $platform = $this->platformFactory->create($configuration->getVcs()); |
||
| 25 | |||
| 26 | if ($platform->existsSplitRepository($repositoryName)) { |
||
| 27 | return $this; |
||
| 28 | } |
||
| 29 | |||
| 30 | $platform->initSplitRepository($repositoryName); |
||
| 31 | |||
| 32 | return $this; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param string[] $commandArguments |
||
| 37 | * |
||
| 38 | * @return string[] |
||
| 39 | */ |
||
| 40 | protected function getCommand(array $commandArguments): array |
||
| 48 | ); |
||
| 49 | } |
||
| 51 |