/**
  * Creates a resource owner service.
  *
  * @param ContainerBuilder $container The container builder
  * @param string           $name      The name of the service
  * @param array            $options   Additional options of the service
  */
 public function createResourceOwnerService(ContainerBuilder $container, $name, array $options)
 {
     // alias services
     if (isset($options['service'])) {
         // set the appropriate name for aliased services, compiler pass depends on it
         $container->setAlias('hwi_oauth.resource_owner.' . $name, $options['service']);
     } else {
         $type = $options['type'];
         unset($options['type']);
         $definition = new DefinitionDecorator('hwi_oauth.abstract_resource_owner.' . Configuration::getResourceOwnerType($type));
         $definition->setClass("%hwi_oauth.resource_owner.{$type}.class%");
         $container->setDefinition('hwi_oauth.resource_owner.' . $name, $definition);
         $definition->replaceArgument(2, $options)->replaceArgument(3, $name);
     }
 }