-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAuraInputModule.php
More file actions
51 lines (49 loc) · 1.78 KB
/
AuraInputModule.php
File metadata and controls
51 lines (49 loc) · 1.78 KB
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
<?php
/**
* This file is part of the Ray.WebFormModule package
*
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Ray\WebFormModule;
use Aura\Filter\FilterFactory;
use Aura\Html\HelperLocatorFactory;
use Aura\Input\AntiCsrfInterface;
use Aura\Input\Builder;
use Aura\Input\BuilderInterface;
use Aura\Input\Filter;
use Aura\Input\FilterInterface;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use Ray\AuraSessionModule\AuraSessionModule;
use Ray\Di\AbstractModule;
use Ray\Di\Scope;
use Ray\WebFormModule\Annotation\FormValidation;
use Ray\WebFormModule\Annotation\InputValidation;
class AuraInputModule extends AbstractModule
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->install(new AuraSessionModule);
$this->bind(Reader::class)->to(AnnotationReader::class)->in(Scope::SINGLETON);
$this->bind(BuilderInterface::class)->to(Builder::class);
$this->bind(FilterInterface::class)->to(Filter::class);
$this->bind(AntiCsrfInterface::class)->to(AntiCsrf::class)->in(Scope::SINGLETON);
$this->bind(FailureHandlerInterface::class)->to(OnFailureMethodHandler::class);
$this->bind(FailureHandlerInterface::class)->annotatedWith('vnd_error')->to(VndErrorHandler::class)->in(Scope::SINGLETON);
$this->bind(HelperLocatorFactory::class);
$this->bind(FilterFactory::class);
$this->bindInterceptor(
$this->matcher->any(),
$this->matcher->annotatedWith(InputValidation::class),
[InputValidationInterceptor::class]
);
$this->bindInterceptor(
$this->matcher->any(),
$this->matcher->annotatedWith(FormValidation::class),
[AuraInputInterceptor::class]
);
}
}