1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sludio\HelperBundle\Captcha\Configurator; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeBuilder; |
6
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
7
|
|
|
|
8
|
|
|
class ReCaptchaConfigurator implements CaptchaConfiguratorInterface |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
public function buildConfiguration(NodeBuilder $node) |
12
|
|
|
{ |
13
|
|
|
// @formatter:off |
14
|
|
|
$node |
15
|
|
|
->scalarNode('public_key')->isRequired()->cannotBeEmpty()->end() |
16
|
|
|
->scalarNode('private_key')->isRequired()->cannotBeEmpty()->end() |
|
|
|
|
17
|
|
|
->booleanNode('verify_host')->defaultValue(false)->end() |
|
|
|
|
18
|
|
|
->booleanNode('ajax')->defaultValue(false)->end() |
19
|
|
|
->scalarNode('locale_key')->defaultValue('en')->end() |
20
|
|
|
->booleanNode('locale_from_request')->defaultValue(false)->end() |
21
|
|
|
->scalarNode('template')->defaultValue('SludioHelperBundle:Captcha:sludio_helper_captcha_recaptcha_widget.html.twig')->end() |
22
|
|
|
->scalarNode('resolver_class')->defaultValue('Sludio\HelperBundle\Captcha\Router\LocaleResolver')->end() |
23
|
|
|
->scalarNode('type_class')->defaultValue('Sludio\HelperBundle\Captcha\Form\Type\RecaptchaType')->end() |
24
|
|
|
->scalarNode('validator_class')->defaultValue('Sludio\HelperBundle\Captcha\Validator\Constraint\IsTrueValidator')->end() |
25
|
|
|
->arrayNode('http_proxy') |
|
|
|
|
26
|
|
|
->addDefaultsIfNotSet() |
27
|
|
|
->children() |
28
|
|
|
->scalarNode('host')->defaultValue(null)->end() |
29
|
|
|
->scalarNode('port')->defaultValue(null)->end() |
30
|
|
|
->scalarNode('auth')->defaultValue(null)->end() |
31
|
|
|
->end() |
|
|
|
|
32
|
|
|
->end() |
33
|
|
|
; |
34
|
|
|
// @formatter:on |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function configureClient(ContainerBuilder $container, $clientServiceKey, array $options = []) |
38
|
|
|
{ |
39
|
|
|
/* RESOLVER */ |
40
|
|
|
$resolver = $clientServiceKey.'.resolver'; |
41
|
|
|
$resolverClass = $container->getParameter($clientServiceKey.'.resolver_class'); |
42
|
|
|
|
43
|
|
|
$resolverDefinition = $container->register($resolver, $resolverClass); |
44
|
|
|
$resolverDefinition->setPublic(false); |
45
|
|
|
$resolverDefinition->setArguments([ |
46
|
|
|
$container->getParameter($clientServiceKey.'.locale_key'), |
47
|
|
|
$container->getParameter($clientServiceKey.'.locale_from_request'), |
48
|
|
|
]); |
49
|
|
|
/* TYPE */ |
50
|
|
|
$type = $clientServiceKey.'.form.type'; |
51
|
|
|
$typeClass = $container->getParameter($clientServiceKey.'.type_class'); |
52
|
|
|
$typeDefinition = $container->register($type, $typeClass); |
53
|
|
|
$typeDefinition->setArguments([ |
54
|
|
|
$container->getParameter($clientServiceKey.'.public_key'), |
55
|
|
|
$container->getParameter($clientServiceKey.'.ajax'), |
56
|
|
|
$container->getDefinition($resolver), |
57
|
|
|
]); |
58
|
|
|
$typeDefinition->addTag('form.type'); |
59
|
|
|
/* VALIDATOR */ |
60
|
|
|
$validator = $clientServiceKey.'.validator.true'; |
61
|
|
|
$validatorClass = $container->getParameter($clientServiceKey.'.validator_class'); |
62
|
|
|
$validatorDefinition = $container->register($validator, $validatorClass); |
63
|
|
|
$validatorDefinition->setArguments([ |
64
|
|
|
$container->getParameter($clientServiceKey.'.private_key'), |
65
|
|
|
$container->getParameter($clientServiceKey.'.http_proxy'), |
66
|
|
|
$container->getParameter($clientServiceKey.'.verify_host'), |
67
|
|
|
]); |
68
|
|
|
$validatorDefinition->addTag('validator.constraint_validator'); |
69
|
|
|
} |
70
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.