private function registerClients(array $config, ContainerBuilder $container)
    {
        foreach ($config['clients'] as $clientType => $clients) {
            $clientFQCN = ($clientType == 'apns') ? 'LinkValue\MobileNotifBundle\Client\ApnsClient' : 'LinkValue\MobileNotifBundle\Client\GcmClient';

            foreach ($clients as $clientName => $clientConfig) {
                $params = isset($clientConfig['params']) ? $clientConfig['params'] : array();
                $services = isset($clientConfig['services']) ? $clientConfig['services'] : array();

                // The final client name is a concatenation of the client type (apns/gcm) and the client name (defined by user) separated by a point '.'
                $clientName = sprintf('%s.%s', $clientType, $clientName);

                // Register client with required stuff
                $client = $container->register(sprintf('link_value_mobile_notif.clients.%s', $clientName), $clientFQCN)
                    ->addMethodCall('setUp', array($params))
                    ->addTag('link_value_mobile_notif.client', array('name' => $clientName))
                ;

                // Set optional logger
                if(!empty($services['logger'])) {
                    $client->addMethodCall('setLogger', array(new Reference($services['logger'])));
                }

                // Set optional profiler
                if(!empty($services['profiler'])) {
                    $client->addMethodCall('setClientProfiler', array(new Reference($services['profiler'])));
                }
            }
        }
    }
private function registerClients(array $config, ContainerBuilder $container)
    {
        foreach ($config['clients'] as $clientType => $clients) {
            $clientFQCN = ($clientType == 'apns') ? 'LinkValue\MobileNotifBundle\Client\ApnsClient' : 'LinkValue\MobileNotifBundle\Client\GcmClient';

            foreach ($clients as $clientName => $clientConfig) {
                $params = isset($clientConfig['params']) ? $clientConfig['params'] : array();
                $services = isset($clientConfig['services']) ? $clientConfig['services'] : array();

                // The final client name is a concatenation of the client type (apns/gcm) and the client name (defined by user) separated by a point '.'
                $clientName = sprintf('%s.%s', $clientType, $clientName);

                // Register client with required stuff
                $client = $container->register(sprintf('link_value_mobile_notif.clients.%s', $clientName), $clientFQCN)
                    ->addMethodCall('setUp', array($params))
                    ->addTag('link_value_mobile_notif.client', array('name' => $clientName))
                ;

                // Set optional logger
                if(!empty($services['logger'])) {
                    $client->addMethodCall('setLogger', array(new Reference($services['logger'])));
                }

                // Set optional profiler
                if(!empty($services['profiler'])) {
                    $client->addMethodCall('setClientProfiler', array(new Reference($services['profiler'])));
                }
            }
        }
    }
private function registerClients ( array $ config , ContainerBuilder $ container ) { foreach ( $ config [ 'clients' ] as $ clientType => $ clients ) { $ clientFQCN = ( $ clientType == 'apns' ) ? 'LinkValue\MobileNotifBundle\Client\ApnsClient' : 'LinkValue\MobileNotifBundle\Client\GcmClient' ; foreach ( $ clients as $ clientName => $ clientConfig ) { $ params = isset ( $ clientConfig [ 'params' ] ) ? $ clientConfig [ 'params' ] : array ( ) ; $ services = isset ( $ clientConfig [ 'services' ] ) ? $ clientConfig [ 'services' ] : array ( ) ; // The final client name is a concatenation of the client type (apns/gcm) and the client name (defined by user) separated by a point '.' $ clientName = sprintf ( '%s.%s' , $ clientType , $ clientName ) ; // Register client with required stuff $ client = $ container -> register ( sprintf ( 'link_value_mobile_notif.clients.%s' , $ clientName ) , $ clientFQCN ) -> addMethodCall ( 'setUp' , array ( $ params ) ) -> addTag ( 'link_value_mobile_notif.client' , array ( 'name' => $ clientName ) ) ; // Set optional logger if ( ! empty ( $ services [ 'logger' ] ) ) { $ client -> addMethodCall ( 'setLogger' , array ( new Reference ( $ services [ 'logger' ] ) ) ) ; } // Set optional profiler if ( ! empty ( $ services [ 'profiler' ] ) ) { $ client -> addMethodCall ( 'setClientProfiler' , array ( new Reference ( $ services [ 'profiler' ] ) ) ) ; } } } }
Register each client as service, such as "link_value_mobile_notif.clients.the_client_type.my_custom_client_name"

@param array $config
@param ContainerBuilder $container
Register each client as service such as link_value_mobile_notif . clients . the_client_type . my_custom_client_name