本文整理匯總了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;
}