本文整理汇总了PHP中Pimple\Container::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::flush方法的具体用法?PHP Container::flush怎么用?PHP Container::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimple\Container
的用法示例。
在下文中一共展示了Container::flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register(Container $app)
{
$app['router.options'] = [];
$app['router.loader_resolver'] = function () {
$fileLocator = new FileLocator();
$loaderResolver = new LoaderResolver([new XmlFileLoader($fileLocator), new PhpFileLoader($fileLocator), new ClosureLoader()]);
if (class_exists('Symfony\\Component\\Yaml\\Parser')) {
$loaderResolver->addLoader(new YamlFileLoader($fileLocator));
}
return $loaderResolver;
};
$app['router'] = function (Application $app) {
$router = new Router(new ClosureLoader(), function () use($app) {
if (isset($app['router.resource'])) {
$userLoader = new DelegatingLoader($app['router.loader_resolver']);
$userRoutes = $userLoader->load($app['router.resource']);
$app['routes']->addCollection($userRoutes);
}
$app->flush();
return $app['routes'];
}, $app['router.options'] + ['debug' => isset($app['debug']) ? $app['debug'] : false, 'matcher_base_class' => 'Silex\\Provider\\Routing\\RedirectableUrlMatcher', 'matcher_class' => 'Silex\\Provider\\Routing\\RedirectableUrlMatcher'], $app['request_context'], $app['logger']);
return $router;
};
$app['request_matcher'] = function (Application $app) {
return $app['router'];
};
$app['url_generator'] = function (Application $app) {
return $app['router'];
};
}
示例2: register
public function register(Container $app)
{
$app['controllers_factory'] = function () use($app) {
return new I18nControllerCollection($app['route_factory'], $app['locale'], $app['i18n_routing.locales']);
};
$app['url_generator'] = function ($app) {
$app->flush();
return new I18nUrlGenerator($app['routes'], $app['request_context']);
};
$app['i18n_routing.locales'] = array('en');
}
示例3: register
public function register(Container $app)
{
$app['controllers_factory'] = function () use($app) {
return new I18nControllerCollection($app['route_factory'], $app['locale'], $app['i18n_routing.locales'], $app['translator'], $app['i18n_routing.translation_domain'], $app['i18n_routing.allow_localized_default']);
};
$app['url_generator'] = function ($app) {
$app->flush();
return new I18nUrlGenerator($app['routes'], $app['request_context']);
};
$app['i18n_routing.locales'] = array('en');
$app['i18n_routing.translation_domain'] = 'routes';
$app['i18n_routing.allow_localized_default'] = false;
}