public function createResourceOwnerService(ContainerBuilder $container, $name, array $options)
    {
        $definitionClassname = $this->getDefinitionClassname();

        // 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, new Alias($options['service'], true));

            return;
        }

        $type = $options['type'];
        unset($options['type']);

        // handle external resource owners with given class
        if (isset($options['class'])) {
            if (!is_subclass_of($options['class'], ResourceOwnerInterface::class)) {
                throw new InvalidConfigurationException(sprintf('Class "%s" must implement interface "HWI\Bundle\OAuthBundle\OAuth\ResourceOwnerInterface".', $options['class']));
            }

            $definition = new $definitionClassname('hwi_oauth.abstract_resource_owner.'.$type);
            $definition->setClass($options['class']);
            unset($options['class']);
        } else {
            $definition = new $definitionClassname('hwi_oauth.abstract_resource_owner.'.Configuration::getResourceOwnerType($type));
            $definition->setClass("%hwi_oauth.resource_owner.$type.class%");
        }

        $definition->replaceArgument(2, $options);
        $definition->replaceArgument(3, $name);
        $definition->setPublic(true);

        $container->setDefinition('hwi_oauth.resource_owner.'.$name, $definition);
    }
public function createResourceOwnerService(ContainerBuilder $container, $name, array $options)
    {
        $definitionClassname = $this->getDefinitionClassname();

        // 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, new Alias($options['service'], true));

            return;
        }

        $type = $options['type'];
        unset($options['type']);

        // handle external resource owners with given class
        if (isset($options['class'])) {
            if (!is_subclass_of($options['class'], ResourceOwnerInterface::class)) {
                throw new InvalidConfigurationException(sprintf('Class "%s" must implement interface "HWI\Bundle\OAuthBundle\OAuth\ResourceOwnerInterface".', $options['class']));
            }

            $definition = new $definitionClassname('hwi_oauth.abstract_resource_owner.'.$type);
            $definition->setClass($options['class']);
            unset($options['class']);
        } else {
            $definition = new $definitionClassname('hwi_oauth.abstract_resource_owner.'.Configuration::getResourceOwnerType($type));
            $definition->setClass("%hwi_oauth.resource_owner.$type.class%");
        }

        $definition->replaceArgument(2, $options);
        $definition->replaceArgument(3, $name);
        $definition->setPublic(true);

        $container->setDefinition('hwi_oauth.resource_owner.'.$name, $definition);
    }
public function createResourceOwnerService ( ContainerBuilder $ container , $ name , array $ options ) { $ definitionClassname = $ this -> getDefinitionClassname ( ) ; // 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 , new Alias ( $ options [ 'service' ] , true ) ) ; return ; } $ type = $ options [ 'type' ] ; unset ( $ options [ 'type' ] ) ; // handle external resource owners with given class if ( isset ( $ options [ 'class' ] ) ) { if ( ! is_subclass_of ( $ options [ 'class' ] , ResourceOwnerInterface :: class ) ) { throw new InvalidConfigurationException ( sprintf ( 'Class "%s" must implement interface "HWI\Bundle\OAuthBundle\OAuth\ResourceOwnerInterface".' , $ options [ 'class' ] ) ) ; } $ definition = new $ definitionClassname ( 'hwi_oauth.abstract_resource_owner.' . $ type ) ; $ definition -> setClass ( $ options [ 'class' ] ) ; unset ( $ options [ 'class' ] ) ; } else { $ definition = new $ definitionClassname ( 'hwi_oauth.abstract_resource_owner.' . Configuration :: getResourceOwnerType ( $ type ) ) ; $ definition -> setClass ( "%hwi_oauth.resource_owner.$type.class%" ) ; } $ definition -> replaceArgument ( 2 , $ options ) ; $ definition -> replaceArgument ( 3 , $ name ) ; $ definition -> setPublic ( true ) ; $ container -> setDefinition ( 'hwi_oauth.resource_owner.' . $ name , $ definition ) ; }
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

@throws InvalidConfigurationException
@throws \Symfony\Component\DependencyInjection\Exception\BadMethodCallException
@throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
Creates a resource owner service .