M1\Vars\Provider\Silex\VarsServiceProvider::register PHP Method

register() public method

Registers the service provider, sets the user defined options and returns the vars instance
public register ( Silex\Application $app )
$app Silex\Application The silex app
    public function register(Application $app)
    {
        $app['vars'] = function ($app) {
            return new Vars($this->entity, $this->createOptions($app));
        };
        $app['vars.merge'] = $app->protect(function () use($app) {
            static $initialized = false;
            if ($initialized) {
                return;
            }
            $initialized = true;
            foreach ($app['vars']->getGlobals() as $key => $value) {
                $app[$key] = $value;
            }
            foreach ($app['vars']->toDots(false) as $key => $value) {
                $app['vars.' . $key] = $value;
            }
        });
    }