ValidatorServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
B register() 0 27 3
A boot() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silex framework.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Eccube\ServiceProvider;
13
14
use Silex\Application;
15
use Silex\ServiceProviderInterface;
16
use Silex\ConstraintValidatorFactory;
17
use Symfony\Component\Validator\Validator;
18
use Symfony\Component\Validator\DefaultTranslator;
19
use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
20
use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
21
22
/**
23
 * Symfony Validator component Provider.
24
 *
25
 * @author Fabien Potencier <[email protected]>
26
 * 
27
 * @deprecated since 3.0.0, to be removed in 3.1
28
 */
29
class ValidatorServiceProvider implements ServiceProviderInterface
30
{
31
    public function register(Application $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
32
    {
33
        $app['validator'] = $app->share(function ($app) {
34
35
            return new Validator(
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Validator\Validator has been deprecated with message: since version 2.5, to be removed in 3.0. Use {@link Validator\RecursiveValidator} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
36
                $app['validator.mapping.class_metadata_factory'],
37
                $app['validator.validator_factory'],
38
                isset($app['translator']) ? $app['translator'] : new DefaultTranslator(),
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Validator\DefaultTranslator has been deprecated with message: since version 2.7, to be removed in 3.0. Use Symfony\Component\Translation\IdentityTranslator instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
39
                'validators',
40
                $app['validator.object_initializers']
41
            );
42
        });
43
44
        $app['validator.mapping.class_metadata_factory'] = $app->share(function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
            return new ClassMetadataFactory(new StaticMethodLoader());
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Valida...ng\ClassMetadataFactory has been deprecated with message: since version 2.5, to be removed in 3.0. Use {@link LazyLoadingMetadataFactory} instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
46
        });
47
48
        $app['validator.validator_factory'] = $app->share(function () use ($app) {
49
            $validators = isset($app['validator.validator_service_ids']) ? $app['validator.validator_service_ids'] : array();
50
51
            return new ConstraintValidatorFactory($app, $validators);
52
        });
53
54
        $app['validator.object_initializers'] = $app->share(function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
            return array();
56
        });
57
    }
58
59
    public function boot(Application $app)
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
60
    {
61
    }
62
}
63