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


PHP Route::hasScheme方法代码示例

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


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

示例1: handleRouteRequirements

 /**
  * {@inheritdoc}
  */
 protected function handleRouteRequirements($pathinfo, $name, Route $route)
 {
     // expression condition
     if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) {
         return array(self::REQUIREMENT_MISMATCH, null);
     }
     // check HTTP scheme requirement
     $scheme = $this->context->getScheme();
     $schemes = $route->getSchemes();
     if ($schemes && !$route->hasScheme($scheme)) {
         return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes)));
     }
     return array(self::REQUIREMENT_MATCH, null);
 }
开发者ID:saj696,项目名称:pipe,代码行数:17,代码来源:RedirectableUrlMatcher.php

示例2: testSchemeIsBC

 public function testSchemeIsBC()
 {
     $route = new Route('/');
     $route->setRequirement('_scheme', 'http|https');
     $this->assertEquals('http|https', $route->getRequirement('_scheme'));
     $this->assertEquals(array('http', 'https'), $route->getSchemes());
     $this->assertTrue($route->hasScheme('https'));
     $this->assertTrue($route->hasScheme('http'));
     $this->assertFalse($route->hasScheme('ftp'));
     $route->setSchemes(array('hTTp'));
     $this->assertEquals('http', $route->getRequirement('_scheme'));
     $route->setSchemes(array());
     $this->assertNull($route->getRequirement('_scheme'));
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:14,代码来源:RouteTest.php

示例3: testScheme

 public function testScheme()
 {
     $route = new Route('/');
     $this->assertEquals(array(), $route->getSchemes(), 'schemes is initialized with array()');
     $this->assertFalse($route->hasScheme('http'));
     $route->setSchemes('hTTp');
     $this->assertEquals(array('http'), $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it');
     $this->assertTrue($route->hasScheme('htTp'));
     $this->assertFalse($route->hasScheme('httpS'));
     $route->setSchemes(array('HttpS', 'hTTp'));
     $this->assertEquals(array('https', 'http'), $route->getSchemes(), '->setSchemes() accepts an array of schemes and lowercases them');
     $this->assertTrue($route->hasScheme('htTp'));
     $this->assertTrue($route->hasScheme('httpS'));
 }
开发者ID:saj696,项目名称:pipe,代码行数:14,代码来源:RouteTest.php

示例4: testLegacySchemeRequirement

 /**
  * @group legacy
  */
 public function testLegacySchemeRequirement()
 {
     $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
     $route = new Route('/');
     $route->setRequirement('_scheme', 'http|https');
     $this->assertEquals('http|https', $route->getRequirement('_scheme'));
     $this->assertEquals(array('http', 'https'), $route->getSchemes());
     $this->assertTrue($route->hasScheme('https'));
     $this->assertTrue($route->hasScheme('http'));
     $this->assertFalse($route->hasScheme('ftp'));
     $route->setSchemes(array('hTTp'));
     $this->assertEquals('http', $route->getRequirement('_scheme'));
     $route->setSchemes(array());
     $this->assertNull($route->getRequirement('_scheme'));
 }
开发者ID:hilmysyarif,项目名称:sisfito,代码行数:18,代码来源:RouteTest.php

示例5: handleRouteRequirements

 /**
  * Handles specific route requirements.
  *
  * @param string $pathinfo The path
  * @param string $name     The route name
  * @param Route  $route    The route
  *
  * @return array The first element represents the status, the second contains additional information
  */
 protected function handleRouteRequirements(Request $request, $pathinfo, $name, Route $route)
 {
     // expression condition
     if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) {
         return array(self::REQUIREMENT_MISMATCH, null);
     }
     // check HTTP scheme requirement
     $scheme = $request->getScheme();
     $status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH;
     return array($status, null);
 }
开发者ID:voxsim,项目名称:minima,代码行数:20,代码来源:UrlMatcher.php


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