当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::flush方法代码示例

本文整理汇总了PHP中Silex\Application::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::flush方法的具体用法?PHP Application::flush怎么用?PHP Application::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Silex\Application的用法示例。


在下文中一共展示了Application::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * {@inheritDoc}
  */
 public function register(Application $app)
 {
     $app['bing_wallpaper'] = $app->share(function (Application $app) {
         $app->flush();
         return new BingWallpaper();
     });
 }
开发者ID:jawish,项目名称:bingwallpaper,代码行数:10,代码来源:BingWallpaperServiceProvider.php

示例2: register

 public function register(Application $app)
 {
     $app['url_generator'] = $app->share(function () use($app) {
         $app->flush();
         return new UrlGenerator($app['routes'], $app['request_context']);
     });
 }
开发者ID:robo47,项目名称:Silex,代码行数:7,代码来源:UrlGeneratorServiceProvider.php

示例3: register

 /**
  * {@inheritdoc}
  *
  * @param \Silex\Application $app
  *
  * @return void
  */
 public function register(Application $app)
 {
     $app['url_generator'] = $app->share(function ($app) {
         $app->flush();
         return $app['routers'];
     });
 }
开发者ID:spryker,项目名称:Application,代码行数:14,代码来源:UrlGeneratorServiceProvider.php

示例4: register

 /**
  * {@inheritDoc}
  */
 public function register(Application $app)
 {
     $app['slugify'] = $app->share(function (Application $app) {
         $app->flush();
         return new Slugify();
     });
 }
开发者ID:ferch01991,项目名称:BlogLaravel,代码行数:10,代码来源:SlugifyServiceProvider.php

示例5: register

 public function register(Application $app)
 {
     $app['sync_zmq'] = $app->share(function (Application $app) {
         $app->flush();
         return new \ZMQContext();
     });
 }
开发者ID:Bit-Wasp,项目名称:payment-requests,代码行数:7,代码来源:SyncZmqContextServiceProvider.php

示例6: register

 public function register(Application $app)
 {
     $app['request_api'] = $app->share(function (Application $app) {
         $app->flush();
         return new RequestApi($app['sync_zmq']);
     });
 }
开发者ID:Bit-Wasp,项目名称:payment-requests,代码行数:7,代码来源:RequestApiServiceProvider.php

示例7: register

 public function register(\Silex\Application $app)
 {
     $app['url_generator'] = $app->share(function ($app) {
         $app->flush();
         return new services\UrlGenerator($app['routes'], $app['request_context']);
     });
 }
开发者ID:JoshuaReneDalley,项目名称:php,代码行数:7,代码来源:UrlGeneratorServiceProvider.php

示例8: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['url_generator'] = $app->share(function ($app) {
         $app->flush();
         $configuration = array('preserve' => isset($app['url_generator.preserve']) ? $app['url_generator.preserve'] : array(), 'token' => isset($app['url_generator.token']) ? $app['url_generator.token'] : false, 'token_len' => isset($app['url_generator.token_length']) ? $app['url_generator.token_length'] : false);
         return new EnhancedUrlGenerator($app['routes'], $app['request_context'], $app['request'], $configuration);
     });
 }
开发者ID:mtrunkat,项目名称:php-enhanced-urlgenerator,代码行数:11,代码来源:EnhancedUrlGeneratorProvider.php

示例9: getRouter

 /**
  * @param RequestContext $context
  *
  * @return SilexRouter
  */
 protected function getRouter(RequestContext $context)
 {
     $app = new Application();
     $app->register(new RoutingServiceProvider());
     $app->get('/hello', 'test')->bind('hello1');
     $app->get('/hello2', 'test')->bind('hello2');
     $app->flush();
     $app['request_context'] = $context;
     return new SilexRouter($app);
 }
开发者ID:project-a,项目名称:silex-routing,代码行数:15,代码来源:SilexRouterTest.php

示例10: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $app = new SilexApplication();
     $app->register(new ConsoleServiceProvider(), ['console.name' => 'Awesome name', 'console.version' => '1.2.3', 'console.request' => ['host' => 'example.com', 'scheme' => 'https', 'httpsPort' => 443, 'url' => 'hello']]);
     $app->register(new TwigServiceProvider(), ['twig.path' => __DIR__ . '/Resources/views', 'twig.options' => ['cache' => false]]);
     $app->get('/test.html', function () {
         return '';
     })->bind('test');
     $app->flush();
     $this->console = $app['console'];
 }
开发者ID:KEIII,项目名称:ConsoleServiceProvider,代码行数:14,代码来源:ConsoleServiceProviderTest.php

示例11: register

 public function register(Application $app)
 {
     $configFile = $this->configFile;
     //configuration
     $app['dump_provider.config'] = $app->share(function ($app) use($configFile) {
         $app->flush();
         $config = Yaml::parse($configFile);
         $config = new Configuration($config);
         return $config;
     });
     // dumper-registry
     $app['dump_provider.dumper_registry'] = $app->share(function ($app) {
         $app->flush();
         $registry = new DumperRegistry($app['dump_provider.config']);
         return $registry;
     });
     $app['dump_provider.dump_repository'] = $app->share(function ($app) {
         $app->flush();
         $repository = new DumpRepository($app['dump_provider.config'], $app['url_generator']);
         return $repository;
     });
 }
开发者ID:swiss-php-friends,项目名称:database-dump-provider,代码行数:22,代码来源:DumperServiceProvider.php

示例12: testBind

 public function testBind()
 {
     $app = new Application();
     $app->get('/', function () {
         return 'hello';
     })->bind('homepage');
     $app->get('/foo', function () {
         return 'foo';
     })->bind('foo_abc');
     $app->flush();
     $routes = $app['routes'];
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $routes->get('homepage'));
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $routes->get('foo_abc'));
 }
开发者ID:johnWIll17,项目名称:silex-blog,代码行数:14,代码来源:FunctionalTest.php

示例13: testGetRoutesWithRoutes

 public function testGetRoutesWithRoutes()
 {
     $app = new Application();
     $app->get('/foo', function () {
         return 'foo';
     });
     $app->get('/bar', function () {
         return 'bar';
     });
     $routes = $app['routes'];
     $this->assertInstanceOf('Symfony\\Component\\Routing\\RouteCollection', $routes);
     $this->assertEquals(0, count($routes->all()));
     $app->flush();
     $this->assertEquals(2, count($routes->all()));
 }
开发者ID:nicodmf,项目名称:Silex,代码行数:15,代码来源:ApplicationTest.php

示例14: register

 public function register(Application $app)
 {
     // Options
     if (!isset($app['router.resource'])) {
         $app['router.resource'] = null;
     }
     if (!isset($app['router.cache_dir'])) {
         $app['router.cache_dir'] = null;
     }
     // Router
     $app['router'] = $app->share(function () use($app) {
         $options = array('cache_dir' => $app['router.cache_dir'], 'debug' => $app['debug']);
         return new Router($app['router.loader'], $app['router.resource'], $options, $app['request_context'], $app['logger']);
     });
     // Annotation loader
     $app['router.annotation.loader'] = $app->share(function () use($app) {
         $reader = $app['doctrine.common.annotation_reader'];
         return new AnnotatedRouteControllerLoader($reader);
     });
     $app['router.file.locator'] = $app->share(function () {
         return new FileLocator();
     });
     $app['router.loader'] = $app->share(function () use($app) {
         return new AnnotationDirectoryLoader($app['router.file.locator'], $app['router.annotation.loader']);
     });
     // Override matcher and generator.
     $app['url_matcher'] = $app->share(function () use($app) {
         /** @var $router Router */
         $router = $app['router'];
         $matcher = $router->getMatcher();
         if ($matcher instanceof UrlMatcherDecorator) {
             // Important to set routes by link. On security service does not working.
             $matcher->setRoutes($app['routes']);
         }
         return $matcher;
     });
     $app['url_generator'] = $app->share(function () use($app) {
         $app->flush();
         /** @var $router Router */
         $router = $app['router'];
         $generator = $router->getGenerator();
         if ($generator instanceof UrlGeneratorDecorator) {
             // Important to set routes by link. On security service does not working.
             $generator->setRoutes($app['routes']);
         }
         return $generator;
     });
 }
开发者ID:elfet,项目名称:silicone,代码行数:48,代码来源:RouterServiceProvider.php

示例15: boot

 /**
  * (non-PHPdoc)
  * @see \Silex\ServiceProviderInterface::boot()
  */
 public function boot(Application $app)
 {
     $app->flush();
     /* @var $routes \Symfony\Component\Routing\RouteCollection */
     $routes = $app['routes'];
     /* @var $route \Silex\Route */
     foreach ($routes->getIterator() as $id => $route) {
         $path = $route->getPath();
         $headers = implode(',', ['Authorization', 'Accept', 'X-Request-With', 'Content-Type', 'X-Session-Token', 'X-Hmac-Hash', 'X-Time', 'X-Url']);
         /* @var $controller \Silex\Controller */
         $controller = $app->match($path, function () use($headers) {
             return new Response(null, 204, ["Allow" => "GET,POST,PUT,DELETE", "Access-Control-Max-Age" => 84600, "Access-Control-Allow-Origin" => "*", "Access-Control-Allow-Credentials" => "false", "Access-Control-Allow-Methods" => "GET,POST,PUT,DELETE", "Access-Control-Allow-Headers" => $headers]);
         });
         $controller->method('OPTIONS');
         /* @var $controllerRoute \Silex\Route */
         $controllerRoute = $controller->getRoute();
         $controllerRoute->setCondition($route->getCondition());
         $controllerRoute->setSchemes($route->getSchemes());
         $controllerRoute->setMethods('OPTIONS');
     }
 }
开发者ID:mrprompt,项目名称:silex-cors-provider,代码行数:25,代码来源:Cors.php


注:本文中的Silex\Application::flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。