1
|
|
|
<?php |
2
|
|
|
namespace Vresh\TwilioBundle\DependencyInjection; |
3
|
|
|
|
4
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
5
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
7
|
|
|
use Symfony\Component\Config\FileLocator; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This file is part of the VreshTwilioBundle. |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please view the LICENSE |
13
|
|
|
* file that was distributed with this source code. |
14
|
|
|
* |
15
|
|
|
* @author Fridolin Koch <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class VreshTwilioExtension extends Extension |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @param array $configs |
21
|
|
|
* @param ContainerBuilder $container |
22
|
|
|
*/ |
23
|
|
|
public function load(array $configs, ContainerBuilder $container) |
24
|
|
|
{ |
25
|
|
|
$loader = new YamlFileLoader($container, new FileLocator(array(__DIR__.'/../Resources/config'))); |
26
|
|
|
$loader->load('services.yml'); |
27
|
|
|
|
28
|
|
|
$configuration = new Configuration(); |
29
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
30
|
|
|
|
31
|
|
|
$container->getDefinition('twilio.api') |
32
|
|
|
->addArgument($config['sid']) |
33
|
|
|
->addArgument($config['authToken']) |
34
|
|
|
->addArgument($config['version']) |
35
|
|
|
->addArgument($config['retryAttempts']); |
36
|
|
|
$container->getDefinition('twilio.capability') |
37
|
|
|
->addArgument($config['sid']) |
38
|
|
|
->addArgument($config['authToken']); |
39
|
|
|
$container->getDefinition('twilio.lookups') |
40
|
|
|
->addArgument($config['sid']) |
41
|
|
|
->addArgument($config['authToken']); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|