|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Azine\HybridAuthBundle\DependencyInjection; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
6
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
|
10
|
|
|
* |
|
11
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
|
12
|
|
|
*/ |
|
13
|
|
|
class Configuration implements ConfigurationInterface |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* {@inheritdoc} |
|
17
|
|
|
*/ |
|
18
|
|
|
public function getConfigTreeBuilder() |
|
19
|
|
|
{ |
|
20
|
|
|
$treeBuilder = new TreeBuilder(); |
|
|
|
|
|
|
21
|
|
|
$rootNode = $treeBuilder->root(AzineHybridAuthExtension::PREFIX); |
|
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
$rootNode->children() |
|
24
|
|
|
->scalarNode(AzineHybridAuthExtension::ENDPOINT_ROUTE)->defaultValue('azine_hybrid_auth_endpoint')->end() |
|
25
|
|
|
->scalarNode(AzineHybridAuthExtension::DEBUG)->defaultFalse()->end() |
|
26
|
|
|
->scalarNode(AzineHybridAuthExtension::DEBUG_FILE)->defaultValue('%kernel.logs_dir%/hybrid_auth_%kernel.environment%.log')->end() |
|
27
|
|
|
->scalarNode(AzineHybridAuthExtension::STORE_FOR_USER)->defaultValue(false)->end() |
|
28
|
|
|
->scalarNode(AzineHybridAuthExtension::STORE_AS_COOKIE)->defaultValue(true)->end() |
|
29
|
|
|
->scalarNode(AzineHybridAuthExtension::EXPIRES_IN_DAYS)->defaultValue(55)->end() |
|
30
|
|
|
->arrayNode(AzineHybridAuthExtension::PROVIDERS) |
|
31
|
|
|
->useAttributeAsKey(AzineHybridAuthExtension::PROVIDER_NAME) |
|
32
|
|
|
->requiresAtLeastOneElement() |
|
33
|
|
|
//->isRequired() |
|
34
|
|
|
->prototype('array') |
|
35
|
|
|
->children() |
|
36
|
|
|
->scalarNode(AzineHybridAuthExtension::ENABLED)->defaultTrue()->end() |
|
37
|
|
|
->scalarNode(AzineHybridAuthExtension::SCOPE)->end() |
|
38
|
|
|
->arrayNode(AzineHybridAuthExtension::WRAPPER) |
|
39
|
|
|
->children() |
|
40
|
|
|
->scalarNode(AzineHybridAuthExtension::WRAPPER_PATH)->end() |
|
41
|
|
|
->scalarNode(AzineHybridAuthExtension::WRAPPER_CLASS)->end() |
|
42
|
|
|
->end() // array |
|
43
|
|
|
->end() // wrapper |
|
44
|
|
|
->arrayNode(AzineHybridAuthExtension::KEYS) |
|
45
|
|
|
->children() |
|
46
|
|
|
->scalarNode(AzineHybridAuthExtension::KEY)->cannotBeEmpty()->end() |
|
47
|
|
|
->scalarNode(AzineHybridAuthExtension::SECRET)->cannotBeEmpty()->end() |
|
48
|
|
|
->end() // array |
|
49
|
|
|
->end() // keys |
|
50
|
|
|
->end() //children |
|
51
|
|
|
->end() // prototype |
|
52
|
|
|
->end() // array |
|
53
|
|
|
->scalarNode(AzineHybridAuthExtension::FILTER)->defaultValue('azine_hybrid_auth_contact_filter_default')->end() |
|
54
|
|
|
->scalarNode(AzineHybridAuthExtension::MERGER)->defaultValue('azine_hybrid_auth_contact_merger_default')->end() |
|
55
|
|
|
->scalarNode(AzineHybridAuthExtension::SORTER)->defaultValue('azine_hybrid_auth_contact_sorter_default')->end() |
|
56
|
|
|
->scalarNode(AzineHybridAuthExtension::GENDER_GUESSER)->defaultValue('azine_hybrid_auth_gender_guesser_default')->end() |
|
57
|
|
|
; |
|
58
|
|
|
|
|
59
|
|
|
return $treeBuilder; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.