protected function collectServices(InputInterface $input, OutputInterface $output) {

    $service_definitions = self::getServiceDefinitions();
    $service_ids = array_keys($service_definitions);

    $services = [];
    while (TRUE) {
      $question = new Question('Type the service name or use arrows up/down. Press enter to continue');
      $question->setValidator([Utils::class, 'validateServiceName']);
      $question->setAutocompleterValues($service_ids);
      $service = $this->ask($input, $output, $question);
      if (!$service) {
        break;
      }
      $services[] = $service;
    }

    $this->vars['services'] = [];
    foreach (array_unique($services) as $service_id) {
      if (isset($service_definitions[$service_id])) {
        $definition = $service_definitions[$service_id];
      }
      else {
        // Build the definition if the service is unknown.
        $definition = [
          'type' => 'Drupal\example\ExampleInterface',
          'name' => str_replace('.', '_', $service_id),
          'description' => "The $service_id service.",
        ];
      }
      $type_parts = explode('\\', $definition['type']);
      $definition['short_type'] = end($type_parts);
      $this->vars['services'][$service_id] = $definition;
    }
    return $this->vars['services'];
  }
protected function collectServices(InputInterface $input, OutputInterface $output) {

    $service_definitions = self::getServiceDefinitions();
    $service_ids = array_keys($service_definitions);

    $services = [];
    while (TRUE) {
      $question = new Question('Type the service name or use arrows up/down. Press enter to continue');
      $question->setValidator([Utils::class, 'validateServiceName']);
      $question->setAutocompleterValues($service_ids);
      $service = $this->ask($input, $output, $question);
      if (!$service) {
        break;
      }
      $services[] = $service;
    }

    $this->vars['services'] = [];
    foreach (array_unique($services) as $service_id) {
      if (isset($service_definitions[$service_id])) {
        $definition = $service_definitions[$service_id];
      }
      else {
        // Build the definition if the service is unknown.
        $definition = [
          'type' => 'Drupal\example\ExampleInterface',
          'name' => str_replace('.', '_', $service_id),
          'description' => "The $service_id service.",
        ];
      }
      $type_parts = explode('\\', $definition['type']);
      $definition['short_type'] = end($type_parts);
      $this->vars['services'][$service_id] = $definition;
    }
    return $this->vars['services'];
  }
protected function collectServices ( InputInterface $ input , OutputInterface $ output ) { $ service_definitions = self :: getServiceDefinitions ( ) ; $ service_ids = array_keys ( $ service_definitions ) ; $ services = [ ] ; while ( TRUE ) { $ question = new Question ( 'Type the service name or use arrows up/down. Press enter to continue' ) ; $ question -> setValidator ( [ Utils :: class , 'validateServiceName' ] ) ; $ question -> setAutocompleterValues ( $ service_ids ) ; $ service = $ this -> ask ( $ input , $ output , $ question ) ; if ( ! $ service ) { break ; } $ services [ ] = $ service ; } $ this -> vars [ 'services' ] = [ ] ; foreach ( array_unique ( $ services ) as $ service_id ) { if ( isset ( $ service_definitions [ $ service_id ] ) ) { $ definition = $ service_definitions [ $ service_id ] ; } else { // Build the definition if the service is unknown. $ definition = [ 'type' => 'Drupal\example\ExampleInterface' , 'name' => str_replace ( '.' , '_' , $ service_id ) , 'description' => "The $service_id service." , ] ; } $ type_parts = explode ( '\\' , $ definition [ 'type' ] ) ; $ definition [ 'short_type' ] = end ( $ type_parts ) ; $ this -> vars [ 'services' ] [ $ service_id ] = $ definition ; } return $ this -> vars [ 'services' ] ; }
Collects services.

@param \Symfony\Component\Console\Input\InputInterface $input
Input instance.
@param \Symfony\Component\Console\Output\OutputInterface $output
Output instance.

@return array
List of collected services.
Collects services .