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


PHP sfRoute::matchesParameters方法代码示例

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


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

示例1: matchesParameters

 /**
  * Returns true if the parameters match this route, false otherwise.
  *
  * @param  mixed   $params The parameters
  * @param  array   $context The context
  *
  * @return Boolean true if the parameters match this route, false otherwise.
  */
 public function matchesParameters($params, $context = array())
 {
     if (isset($params['sf_method'])) {
         // enforce the sf_method requirement
         if (!in_array(strtolower($params['sf_method']), $this->requirements['sf_method'])) {
             return false;
         }
         unset($params['sf_method']);
     }
     return parent::matchesParameters($params, $context);
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:19,代码来源:sfRequestRoute.class.php

示例2: matchesParameters

 public function matchesParameters($params, $context = array())
 {
     $culture = $this->getCulture($context);
     if (isset($this->requirements['sf_host_culture'])) {
         $sfHostCulture = $this->requirements['sf_host_culture'];
         if ($culture != $sfHostCulture) {
             return false;
         }
     }
     return parent::matchesParameters($params, $context);
 }
开发者ID:voota,项目名称:voota,代码行数:11,代码来源:sfRequestHostCultureRoute.php

示例3: matchesParameters

 /**
  * Returns true if the parameters matches this route, false otherwise.
  *
  * @param  mixed   $params The parameters
  * @param  array   $context The context
  *
  * @return Boolean         true if the parameters matches this route, false otherwise.
  */
 public function matchesParameters($params, $context = array())
 {
     if (isset($params['sf_method'])) {
         if (!isset($this->requirements['sf_method'])) {
             $this->requirements['sf_method'] = 'get';
         }
         // enforce the sf_method requirement
         if ($this->requirements['sf_method'] != $params['sf_method']) {
             return false;
         }
         unset($params['sf_method']);
     }
     return parent::matchesParameters($params, $context);
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:22,代码来源:sfRequestRoute.class.php

示例4: sfRoute

$route->setDefaultParameters(array('foo' => 'bar'));
$t->is($route->matchesParameters(array()), true, '->matchesParameters() merges the routing default parameters with the provided parameters to match the route');
$route = new sfRoute('/:foo', array(), array('foo' => '\\d+'));
$t->is($route->matchesParameters(array('foo' => 'bar')), false, '->matchesParameters() enforces requirements');
$route = new sfRoute('/:foo', array(), array('foo' => '\\d+'));
$t->is($route->matchesParameters(array('foo' => 12)), true, '->matchesParameters() enforces requirements');
$route = new sfRoute('/', array('foo' => 'bar'));
$t->is($route->matchesParameters(array('foo' => 'foobar')), false, '->matchesParameters() checks that there is no parameter that is not a pattern variable');
$route = new sfRoute('/', array('foo' => 'bar'));
$t->is($route->matchesParameters(array('foo' => 'bar')), true, '->matchesParameters() can override a parameter that is not a pattern variable if the value is the same as the default one');
$route = new sfRoute('/:foo', array('bar' => 'foo'));
$t->is($route->matchesParameters(array('foo' => 'bar', 'bar' => 'foo')), true, '->matchesParameters() can override a parameter that is not a pattern variable if the value is the same as the default one');
$route = new sfRoute('/:foo');
$t->is($route->matchesParameters(array('foo' => 'bar', 'bar' => 'foo')), true, '->generate() matches even if there are extra parameters');
$route = new sfRoute('/:foo', array(), array(), array('extra_parameters_as_query_string' => false));
$t->is($route->matchesParameters(array('foo' => 'bar', 'bar' => 'foo')), false, '->generate() does not match if there are extra parameters if extra_parameters_as_query_string is set to false');
// ->generate()
$t->diag('->generate()');
$route = new sfRoute('/:foo');
$t->is($route->generate(array('foo' => 'bar')), '/bar', '->generate() generates a URL with the given parameters');
$route = new sfRoute('/:foo/:foobar');
$t->is($route->generate(array('foo' => 'bar', 'foobar' => 'barfoo')), '/bar/barfoo', '->generate() replaces longer variables first');
$route = new sfRoute('/:foo');
$t->is($route->generate(array('foo' => '')), '/', '->generate() generates a route if a variable is empty');
$t->is($route->generate(array('foo' => null)), '/', '->generate() generates a route if a variable is empty');
/*
$route = new sfRoute('/:foo/bar');
try
{
  $route->generate(array('foo' => ''));
  $t->fail('->generate() cannot generate a route if a variable is empty and mandatory');
开发者ID:mediasadc,项目名称:alba,代码行数:31,代码来源:sfRouteTest.php

示例5: matchesParameters

 /**
  * @see sfRoute
  */
 public function matchesParameters($params, $context = array())
 {
     return parent::matchesParameters($this->filterParams($params), $context);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:QubitRoute.class.php


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