protected function createAuthentication(ContainerBuilder $container, $authentication, $type)
    {
        if ($authentication['type'] == 'basic' && (!isset($authentication['username']) || !isset($authentication['password']))) {
            throw new \LogicException('Username and password are mandatory if using the basic authentication');
        }

        if ($authentication['type'] == 'basic') {
            // Create an authentication service
            $authenticationDefinition = new Definition(
                'Bluetea\Api\Authentication\BasicAuthentication',
                array('username' => $authentication['username'], 'password' => $authentication['password'])
            );
        } elseif ($authentication['type'] == 'anonymous') {
            // Create an authentication service
            $authenticationDefinition = new Definition(
                'Bluetea\Api\Authentication\AnonymousAuthentication'
            );
        } else {
            throw new InvalidConfigurationException('Invalid authentication');
        }

        $container->setDefinition(sprintf('jira_rest_api.%s_authentication', $type), $authenticationDefinition);
    }
protected function createAuthentication(ContainerBuilder $container, $authentication, $type)
    {
        if ($authentication['type'] == 'basic' && (!isset($authentication['username']) || !isset($authentication['password']))) {
            throw new \LogicException('Username and password are mandatory if using the basic authentication');
        }

        if ($authentication['type'] == 'basic') {
            // Create an authentication service
            $authenticationDefinition = new Definition(
                'Bluetea\Api\Authentication\BasicAuthentication',
                array('username' => $authentication['username'], 'password' => $authentication['password'])
            );
        } elseif ($authentication['type'] == 'anonymous') {
            // Create an authentication service
            $authenticationDefinition = new Definition(
                'Bluetea\Api\Authentication\AnonymousAuthentication'
            );
        } else {
            throw new InvalidConfigurationException('Invalid authentication');
        }

        $container->setDefinition(sprintf('jira_rest_api.%s_authentication', $type), $authenticationDefinition);
    }
protected function createAuthentication ( ContainerBuilder $ container , $ authentication , $ type ) { if ( $ authentication [ 'type' ] == 'basic' && ( ! isset ( $ authentication [ 'username' ] ) || ! isset ( $ authentication [ 'password' ] ) ) ) { throw new \ LogicException ( 'Username and password are mandatory if using the basic authentication' ) ; } if ( $ authentication [ 'type' ] == 'basic' ) { // Create an authentication service $ authenticationDefinition = new Definition ( 'Bluetea\Api\Authentication\BasicAuthentication' , array ( 'username' => $ authentication [ 'username' ] , 'password' => $ authentication [ 'password' ] ) ) ; } elseif ( $ authentication [ 'type' ] == 'anonymous' ) { // Create an authentication service $ authenticationDefinition = new Definition ( 'Bluetea\Api\Authentication\AnonymousAuthentication' ) ; } else { throw new InvalidConfigurationException ( 'Invalid authentication' ) ; } $ container -> setDefinition ( sprintf ( 'jira_rest_api.%s_authentication' , $ type ) , $ authenticationDefinition ) ; }
Create authentication services

@param ContainerBuilder $container
@param $authentication
@param $type
@throws \LogicException
@throws \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
Create authentication services