Skip to content

Commit

Permalink
added guzzle 5 client configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanueleMinotto committed Apr 22, 2015
1 parent fc60c2e commit 5a6d17e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function getConfigTreeBuilder()
->scalarNode('api_key')
->defaultNull()
->end()
->scalarNode('guzzle_service')
->defaultNull()
->end()
->end();

return $treeBuilder;
Expand Down
6 changes: 6 additions & 0 deletions DependencyInjection/EmbedlyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
Expand Down Expand Up @@ -37,5 +38,10 @@ public function load(array $config, ContainerBuilder $container)
$loader->load('services.xml');

$container->setParameter('embedly.api_key', $config['api_key']);

if (null !== $config['guzzle_service'] && $container->hasDefinition($config['guzzle_service'])) {
$definition = $container->getDefinition('embedly');
$definition->addArgument(new Reference($config['guzzle_service']));
}
}
}

0 comments on commit 5a6d17e

Please sign in to comment.