@param array $services

@return array
10493
protected function format(array $services): array
    {
        return Collection::make($services)->map(function (array $service) {
            return [
                'id'   => $service['ID'],
                'name' => $service['Service'],
                'host' => $service['Address'],
                'port' => $service['Port'],
            ];
        })->groupBy('name')->toArray();
    }
420107
protected function getConfig($services)
    {
        if ($this->config !== null) {
            return $this->config;
        }

        if (!$services->has('Config')) {
            $this->config = [];

            return $this->config;
        }

        $config = $services->get('Config');
        if (!isset($config['sphinxql'])
            || !is_array($config['sphinxql'])
        ) {
            $this->config = [];

            return $this->config;
        }

        $config = $config['sphinxql'];
        if (!isset($config['adapters'])
            || !is_array($config['adapters'])
        ) {
            $this->config = [];

            return $this->config;
        }

        $this->config = $config['adapters'];

        return $this->config;
    }
891331
protected function _getServices($services)
    {
        if ($services) {
            foreach ($services as $index => $service) {
                if (!$this->_di->has($service)) {
                    if ($this->_di->has($service . 'Mongodb')) {
                        $services[$index] = $service . 'Mongodb';
                    } elseif ($this->_di->has($service . '_mongodb')) {
                        $services[$index] = $service . '_mongodb';
                    } else {
                        $this->console->warn(['`:service` service is not exists: ignoring', 'service' => $service]);
                        unset($services[$index]);
                    }
                }
            }
        } else {
            $services = [];
            foreach ($this->configure->components as $service => $config) {
                $config = json_encode($config, JSON_UNESCAPED_SLASHES);
                if (preg_match('#mongodb://#', $config)) {
                    $services[] = $service;
                }
            }
        }

        return $services;
    }
588969
protected function get($service, array &$options)
    {
        if (isset($options[$service]) && is_object($options[$service])) {
            return $options[$service];
        }

        $service = explode('_', $service);
        $service = array_map('ucfirst', $service);
        $service = 'get' . implode('', $service);

        return $options[$service] = $this->$service($options);
    }
1199824
function withScoped(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type, self::SCOPED);
        }
        return $this;
    }
186996
protected function getServiceUrls($service)
    {
        if (!$this->_config) {
            $httpClient = new HttpClient();
            $httpClient->transport = CurlTransport::class;
            $requests = [];
            foreach ($this->discoverUrls as $discoverUrl) {
                $requests[] = $httpClient->get($discoverUrl);
            }
            $responses = $httpClient->batchSend($requests);

            $list = [];
            foreach ($responses as $response) {
                foreach ($response->data as $name => $url) {
                    $list[$name][] = $url;
                }
            }

            $this->_config = $list;
        }

        if (isset($this->_config[$service]) && $this->_config[$service]) {
            return $this->_config[$service];
        } else {
            throw new ErrorException('不存在该服务，请检查服务中心');
        }
    }
1050766
function withServices(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type);
        }
        return $this;
    }
743791
public function getServices()
    {
        $mergedModuleServices = array();

        foreach ($this->services as $services) {
            $mergedModuleServices = ArrayUtils::merge($mergedModuleServices, $services);
        }

        return $mergedModuleServices;
    }
1016219
public function collectDataServices(array $services) {
    $todo_services = [];
    foreach ($services as $priority => $allservices) {
      /*
       * @var integer $key
       * @var OpenyDataServiceInterface $service
       */
      foreach ($allservices as $key => $service) {
        foreach ($service->addDataServices($todo_services) as $method) {
          $this->services[$method][$priority] = $service;
          krsort($this->services[$method]);
        }
      }
    }
  }
1240401
public function setServices(Array $services) {
    $this->services = array();
    foreach ($services as $service) {
      $this->addService($service);
    }
    return $this;
  }
887661
public function getConfig($service)
    {
        $baseConfig = array(
            'credentials' => $this->config['credentials'],
            'region' => $this->config['region'],
            'profile' => $this->config['profile'],
            'version' => 'latest',
        );

        if (!isset($this->config['services'][$service])) {
            return $baseConfig;
        }

        return array_merge($baseConfig, $this->config['services'][$service]);
    }
1056940
private function getAllows(array $methods)
    {
        $allows = [];
        foreach ($methods as $method) {
            if (in_array($method->name, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
                $allows[] = strtoupper(substr($method->name, 2));
            }
        }

        return $allows;
    }
1157789
protected function getParameters(array $keys)
    {
        $parameters = [];

        foreach ($keys as $parameterKey => $default) {
            $parameters[$parameterKey] = $this->get($parameterKey, $default);
        }

        return $parameters;
    }
231926
public function getUrl(array $services)
    {
        $chunks = array();

        foreach ($services as $serviceName => $details) {
            foreach ($details['dependencies'] as $dependency) {
                $chunks[] = '[' . $serviceName . ']->[' . $dependency . ']';
            }
        }

        return implode(',', $chunks);
    }
1309993
protected function getDefaultOptions(ServiceLocatorInterface $services)
    {
        $options = parent::getDefaultOptions($services);

        if (!$options instanceof CrudControllerOptionsInterface) {
            $optionsType = CrudControllerOptions::class;
            $options = new $optionsType($options ?: []);
        }

        return $options;
    }
157029
protected function getServiceNames()
    {
        $names = [];

        foreach ($this->getServices() as $name => $info) {
            if (!isset($info['type'])) {
                continue;
            }
            $names[$name] = $info['type'];
        }

        return $names;
    }
1315933
public function setService($services)
    {
        if (!is_array($services)) {
            throw new \Exception(__METHOD__.' accept parameter as array.');
        }

        foreach ($services as $key => $alias) {
            $this[$key] = $alias;
        }

        return $this;
    }