This commit is contained in:
R. Eric Wheeler 2016-07-11 14:58:53 -07:00
parent 15627da05c
commit a00d9b49a0
1 changed files with 45 additions and 47 deletions

View File

@ -16,26 +16,26 @@ use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Silex\Api\BootableProviderInterface;
use Silex\Application;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Component\Validator\Constraints\{
Collection,
Email,
Length,
NotBlank,
NotNull,
Regex
};
/**
* Class ConfigServiceProvider
*
* @package Sikofitt\Config
*/
class ConfigServiceProvider implements ServiceProviderInterface, BootableProviderInterface
{
class ConfigServiceProvider implements ServiceProviderInterface, BootableProviderInterface {
/**
* @param Container $app
*/
public function register(Container $app)
{
public function register(Container $app) {
$app['config'] = function ($app) {
$config = Config::load($app['config.path']);
@ -43,15 +43,13 @@ class ConfigServiceProvider implements ServiceProviderInterface, BootableProvide
};
}
public function boot(Application $app)
{
public function boot(Application $app) {
$configItems = [
'email' => $app->config('app.email'),
'phone' => $app->config('app.phone'),
];
$constraints = [
'email' => [
new NotNull(['message' => 'Email value in app config is not present.']),