forked from FriendsOfSymfony/FOSFacebookBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFOSFacebookExtension.php
executable file
·75 lines (62 loc) · 2.14 KB
/
FOSFacebookExtension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
* This file is part of the FOSFacebookBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\FacebookBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
class FOSFacebookExtension extends Extension
{
protected $resources = array(
'facebook' => 'facebook.xml',
'security' => 'security.xml',
);
public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$this->loadDefaults($container);
if (isset($config['alias'])) {
$container->setAlias($config['alias'], 'fos_facebook.api');
}
foreach (array('api', 'helper', 'twig') as $attribute) {
$container->setParameter('fos_facebook.'.$attribute.'.class', $config['class'][$attribute]);
}
foreach (array('file', 'app_id', 'secret', 'cookie', 'domain', 'logging', 'culture', 'permissions') as $attribute) {
$container->setParameter('fos_facebook.'.$attribute, $config[$attribute]);
}
}
/**
* @codeCoverageIgnore
*/
public function getXsdValidationBasePath()
{
return __DIR__ . '/../Resources/config/schema';
}
/**
* @codeCoverageIgnore
*/
public function getNamespace()
{
return 'http://symfony.com/schema/dic/fos_facebook';
}
/**
* @codeCoverageIgnore
*/
protected function loadDefaults($container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
foreach ($this->resources as $resource) {
$loader->load($resource);
}
}
}