Command/WithAppRepositoryBucketCommand.php
protected function getRepositoryAndIndices(
        InputInterface $input,
        OutputInterface $output
    ): array {
        $appName = $input->getArgument('app-name');
        $configuration = $this->repositoryBucket->getConfiguration();

        if (!isset($configuration[$appName])) {
            throw new Exception(sprintf('App %s not found under apisearch configuration', $appName));
        }

        $appId = $configuration[$appName]['app_id'];
        self::printInfoMessage(
            $output,
            $this->getHeader(),
            "App: <strong>{$appName} / {$appId}</strong>"
        );

        if (!$input->hasOption('index-name')) {
            return [$configuration[$appName]['app_id'], []];
        }

        $indexNamesAsArray = $configuration[$appName]['indices'] ?? [];

        $indices = array_map(function (string $indexName) use ($indexNamesAsArray, $appName, $output) {
            if (!isset($indexNamesAsArray[$indexName])) {
                throw new Exception(sprintf(
                    'Index %s not found under %s repository. Indices availables: %s',
                    $indexName,
                    $appName,
                    implode(', ', array_keys($indexNamesAsArray))
                ));
            }

            $indexId = $indexNamesAsArray[$indexName];
            self::printInfoMessage(
                $output,
                $this->getHeader(),
                "Index: <strong>{$indexName} / {$indexId}</strong>"
            );

            return IndexUUID::createById($indexId);
        }, $input->getOption('index-name'));

        return [
            AppUUID::createById($appId),
            $indices,
        ];
    }
protected function getRepositoryAndIndices(
        InputInterface $input,
        OutputInterface $output
    ): array {
        $appName = $input->getArgument('app-name');
        $configuration = $this->repositoryBucket->getConfiguration();

        if (!isset($configuration[$appName])) {
            throw new Exception(sprintf('App %s not found under apisearch configuration', $appName));
        }

        $appId = $configuration[$appName]['app_id'];
        self::printInfoMessage(
            $output,
            $this->getHeader(),
            "App: <strong>{$appName} / {$appId}</strong>"
        );

        if (!$input->hasOption('index-name')) {
            return [$configuration[$appName]['app_id'], []];
        }

        $indexNamesAsArray = $configuration[$appName]['indices'] ?? [];

        $indices = array_map(function (string $indexName) use ($indexNamesAsArray, $appName, $output) {
            if (!isset($indexNamesAsArray[$indexName])) {
                throw new Exception(sprintf(
                    'Index %s not found under %s repository. Indices availables: %s',
                    $indexName,
                    $appName,
                    implode(', ', array_keys($indexNamesAsArray))
                ));
            }

            $indexId = $indexNamesAsArray[$indexName];
            self::printInfoMessage(
                $output,
                $this->getHeader(),
                "Index: <strong>{$indexName} / {$indexId}</strong>"
            );

            return IndexUUID::createById($indexId);
        }, $input->getOption('index-name'));

        return [
            AppUUID::createById($appId),
            $indices,
        ];
    }
protected function getRepositoryAndIndices ( InputInterface $ input , OutputInterface $ output ) : array { $ appName = $ input -> getArgument ( 'app-name' ) ; $ configuration = $ this -> repositoryBucket -> getConfiguration ( ) ; if ( ! isset ( $ configuration [ $ appName ] ) ) { throw new Exception ( sprintf ( 'App %s not found under apisearch configuration' , $ appName ) ) ; } $ appId = $ configuration [ $ appName ] [ 'app_id' ] ; self :: printInfoMessage ( $ output , $ this -> getHeader ( ) , "App: <strong>{$appName} / {$appId}</strong>" ) ; if ( ! $ input -> hasOption ( 'index-name' ) ) { return [ $ configuration [ $ appName ] [ 'app_id' ] , [ ] ] ; } $ indexNamesAsArray = $ configuration [ $ appName ] [ 'indices' ] ?? [ ] ; $ indices = array_map ( function ( string $ indexName ) use ( $ indexNamesAsArray , $ appName , $ output ) { if ( ! isset ( $ indexNamesAsArray [ $ indexName ] ) ) { throw new Exception ( sprintf ( 'Index %s not found under %s repository. Indices availables: %s' , $ indexName , $ appName , implode ( ', ' , array_keys ( $ indexNamesAsArray ) ) ) ) ; } $ indexId = $ indexNamesAsArray [ $ indexName ] ; self :: printInfoMessage ( $ output , $ this -> getHeader ( ) , "Index: <strong>{$indexName} / {$indexId}</strong>" ) ; return IndexUUID :: createById ( $ indexId ) ; } , $ input -> getOption ( 'index-name' ) ) ; return [ AppUUID :: createById ( $ appId ) , $ indices , ] ; }
Check repository and indices existence.

@param InputInterface  $input
@param OutputInterface $output

@return array

@throws Exception
Check repository and indices existence .