Collect remotes info.

@throws \RuntimeException

@return RemoteInfo[]
15347
protected function collectRemotes()
    {
        $remotesResult = $this->executor->execute('git remote -v');

        if (count($remotesResult) === 0) {
            throw new \RuntimeException();
        }

        // parse command result
        $results = [];

        foreach ($remotesResult as $result) {
            if (strpos($result, ' ') !== false) {
                list($remote) = explode(' ', $result, 2);

                $results[] = $remote;
            }
        }

        // filter
        $results = array_unique($results);

        // create Remote instances
        $remotes = [];

        foreach ($results as $result) {
            if (strpos($result, "\t") !== false) {
                list($name, $url) = explode("\t", $result, 2);

                $remote = new RemoteInfo();
                $remotes[] = $remote->setName(trim($name))->setUrl(trim($url));
            }
        }

        return $remotes;
    }
149904
public function loadContentInfoByRemoteId($remoteId)
    {
        try {
            return $this->innerGateway->loadContentInfoByRemoteId($remoteId);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (\PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
30883
public function getParamsInfo(): array
    {
        $paramsInfo = [];

        foreach ($this->getParamNames() as $paramName) {
            $paramsInfo[$paramName] = $this->getParamInfo($paramName);
        }

        return $paramsInfo;
    }
121892
public function getData(): array
    {
        $combined = $this->getDelegated()->getData();
        foreach (parent::getData() as $key => $value) {
            if (!array_key_exists($key, $combined)) {
                $combined[$key] = $value;
                continue;
            }
            if (\is_array($value)) {
                if (!is_array($combined[$key])) {
                    throw new \RuntimeException('Can not merge key "' . $key . '", parent value is not an array.');
                }

                /** @noinspection SlowArrayOperationsInLoopInspection - can not optimize here */
                $combined[$key] = array_merge($combined[$key], $value);
                continue;
            }

            $combined[$key] = $value;
        }

        return $combined;
    }
980761
public function getRepositoryCredentials()
    {
        $endpoint = $this->vcs->runLocally('currentEndpoint');
        $user = $this->bash->runLocally('whoami');

        return $this->askQuestions('vcs', [
            'repository' => ['Where is your code located?', $endpoint],
            'username' => ['What is the username for it?', $user],
            'password' => 'And the password?',
        ]);
    }
1289670
private function parseArgs(): array
    {
        if (null === $this->options && count($this->longopts) === 0 && null === $this->userInput) {
            return $this->fixArgs($_SERVER['argv']);
        }

        if (null !== $this->userInput) {
            $this->collectOptionsFromUserInputClass();
        }

        $parseCommandLineOptions = $this->cliOptionParser;
        $parsedVars = $parseCommandLineOptions($this->options, $this->longopts);
        if (false === $parsedVars) {
            throw new \RuntimeException(
                    'Error parsing "' . join(' ', $_SERVER['argv'])
                    . '" with ' . $this->options
                    . ' and ' . join(' ', $this->longopts)
            );
        }

        return $this->fixArgs($_SERVER['argv'], $parsedVars);
    }
509914
public function getRemoteGroups(): array
    {
        $result = [];

        if (!(bool)Configure::read('Groups.remoteGroups.enabled')) {
            return $result;
        }

        if ((bool)Configure::read('Groups.remoteGroups.LDAP.enabled')) {
            $result = $this->_getLdapGroups();
        }

        return $result;
    }
910982
public function getRevScanInfo(){
        if (isset($this->_receive['ScanCodeInfo'])){
            if (!is_array($this->_receive['SendPicsInfo'])) {
                $array=(array)$this->_receive['ScanCodeInfo'];
                $this->_receive['ScanCodeInfo']=$array;
            }else {
                $array=$this->_receive['ScanCodeInfo'];
            }
        }
        if (isset($array) && count($array) > 0) {
            return $array;
        } else {
            return false;
        }
    }
591521
public function scriptVariables()
    {
        $data = json_encode([
            'locale' => $this->get('locale'),
            'app_name' => $this->get('app_name'),
            'app_skin' => $this->get('app_skin'),
            'app_theme' => $this->get('app_theme'),
            'app_url' => $this->get('app_url'),
        ]);

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new \RuntimeException(json_last_error_msg());
        }

        return $data;
    }
1225734
private function __index(): array {
        $this->indexedRes  = array();
        $this->commitedRes = array();

        if (count($this->paths) === 0) {
            throw new RuntimeException('No paths set');
        }

        try {
            foreach ($this->paths as $path) {
                foreach (new DirectoryIterator(self::containerDir() . $path) as $i) {
                    $this->indexEntry($i);
                }
            }
        } catch (\Throwable $e) {
            if ($e instanceof IndexerException) {
                $this->commitedRes = array_merge($this->commitedRes, $e->getCommitedResources());
            }
            throw new IndexerException($e->getMessage(), $e->getCode(), $e, $this->commitedRes);
        }

        return array($this->indexedRes, $this->commitedRes);
    }
821980
protected static function fetch()
    {
        $command = array(
            'LINUX' => new Commands\Linux(),
            'MAC' => new Commands\Mac(),
            'WIN' => new Commands\Windows()
        );

        $instance = 'No valid desktop notifier found.';

        if ($command['WIN']->isAvailable()) {
            $instance = $command['WIN'];
        } elseif($command['LINUX']->isAvailable()) {
            $instance = $command['LINUX'];
        } elseif($command['MAC']->isAvailable()) {
            $instance = $command['MAC'];
        }

        if (is_string($instance)) {
            throw new \RuntimeException($instance);
        }

        return $instance;
    }
44677
private function readBundleConfiguration(): array
    {
        $configurationFilePath = $this->getApplicationDir() . '/config/bundles.yml';
        if (!is_readable($configurationFilePath)) {
            throw new \RuntimeException('The file "' . $configurationFilePath . '" could not be read.', 1504272377);
        }

        return Yaml::parse(file_get_contents($configurationFilePath));
    }
1239742
public function listDeployKeys(): array
    {
        return $this->getApi()->request($this->getApi()
                                             ->sprintf('/repos/:owner/:repo/keys', $this->getRepositories()->getOwner(),
                                                 $this->getRepositories()->getRepo()));
    }
35251
public function getInfo()
    {
        return array(
            'ucache_meminfo' => wincache_ucache_meminfo(),
            'ucache_info' =>    wincache_ucache_info(),
            'session_cache_info' => wincache_scache_info(),
            'session_cache_meminfo' =>  wincache_scache_meminfo(),
            'rp_meminfo' => wincache_rplist_meminfo(),
            'rp_fileinfo' =>    wincache_rplist_fileinfo(),
            'opcode_fileinfo' =>    wincache_ocache_fileinfo(),
            'opcode_meminfo' => wincache_ocache_meminfo(),
            'filecache_meminfo' =>  wincache_fcache_fileinfo(),
            'filecache_fileinfo' => wincache_fcache_meminfo()
        );
    }
1256663
public function getBasicTagDataByRemoteId($remoteId)
    {
        try {
            return $this->innerGateway->getBasicTagDataByRemoteId($remoteId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
919577
public function listRepositoryEvents(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/events',
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo()));
    }
411614
public function getFunctions()
    {
        return [
            /**
             * Get a service from the container.
             */
            new ExpressionFunction(
                'service',
                function () {
                    throw new RuntimeException(
                        'Function "rule" can\'t be compiled.'
                    );
                },
                function (array $context, $value) {
                    return $this
                        ->container
                        ->get($value);
                }
            ),

            /**
             * Get a parameter from the container.
             */
            new ExpressionFunction(
                'parameter',
                function () {
                    throw new RuntimeException(
                        'Function "rule" can\'t be compiled.'
                    );
                },
                function (array $context, $value) {
                    return $this
                        ->container
                        ->getParameter($value);
                }
            ),
        ];
    }