當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。