Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
0 / 0 |
CRAP | |
100.00% |
0 / 0 |
ValidatorServiceProvider | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
5 | |
100.00% |
0 / 0 |
register | |
100.00% |
1 / 1 |
3 | |
100.00% |
0 / 0 |
|||
anonymous function | |
100.00% |
1 / 1 |
1 | |
100.00% |
0 / 0 |
|||
boot | |
100.00% |
1 / 1 |
1 | |
100.00% |
0 / 0 |
<?php | |
/* | |
* This file is part of the Silex framework. | |
* | |
* (c) Fabien Potencier <fabien@symfony.com> | |
* | |
* For the full copyright and license information, please view the LICENSE | |
* file that was distributed with this source code. | |
*/ | |
namespace Eccube\ServiceProvider; | |
use Silex\Application; | |
use Silex\ServiceProviderInterface; | |
use Silex\ConstraintValidatorFactory; | |
use Symfony\Component\Validator\Validator; | |
use Symfony\Component\Validator\DefaultTranslator; | |
use Symfony\Component\Validator\Mapping\ClassMetadataFactory; | |
use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; | |
/** | |
* Symfony Validator component Provider. | |
* | |
* @author Fabien Potencier <fabien@symfony.com> | |
* | |
* @deprecated since 3.0.0, to be removed in 3.1 | |
*/ | |
class ValidatorServiceProvider implements ServiceProviderInterface | |
{ | |
public function register(Application $app) | |
{ | |
$app['validator'] = $app->share(function ($app) { | |
return new Validator( | |
$app['validator.mapping.class_metadata_factory'], | |
$app['validator.validator_factory'], | |
isset($app['translator']) ? $app['translator'] : new DefaultTranslator(), | |
'validators', | |
$app['validator.object_initializers'] | |
); | |
}); | |
$app['validator.mapping.class_metadata_factory'] = $app->share(function ($app) { | |
return new ClassMetadataFactory(new StaticMethodLoader()); | |
}); | |
$app['validator.validator_factory'] = $app->share(function () use ($app) { | |
$validators = isset($app['validator.validator_service_ids']) ? $app['validator.validator_service_ids'] : array(); | |
return new ConstraintValidatorFactory($app, $validators); | |
}); | |
$app['validator.object_initializers'] = $app->share(function ($app) { | |
return array(); | |
}); | |
} | |
public function boot(Application $app) | |
{ | |
} | |
} |