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


PHP UrlGeneratorInterface::setStrictRequirements方法代码示例

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


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

示例1: getGenerator

 /**
  * Gets the UrlGenerator instance associated with this Router.
  *
  * @return UrlGeneratorInterface A UrlGeneratorInterface instance
  */
 public function getGenerator()
 {
     if (null !== $this->generator) {
         return $this->generator;
     }
     if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
         $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger);
     } else {
         $class = $this->options['generator_cache_class'];
         $baseClass = $this->options['generator_base_class'];
         $that = $this;
         // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
         $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $class . '.php', function (ConfigCacheInterface $cache) use($that, $class, $baseClass) {
             $dumper = $that->getGeneratorDumperInstance();
             $options = array('class' => $class, 'base_class' => $baseClass);
             $cache->write($dumper->dump($options), $that->getRouteCollection()->getResources());
         });
         require_once $cache->getPath();
         $this->generator = new $class($this->context, $this->logger);
     }
     if ($this->generator instanceof ConfigurableRequirementsInterface) {
         $this->generator->setStrictRequirements($this->options['strict_requirements']);
     }
     return $this->generator;
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:30,代码来源:Router.php

示例2: getGenerator

 /**
  * Gets the UrlGenerator instance associated with this Router.
  *
  * @return UrlGeneratorInterface A UrlGeneratorInterface instance
  */
 public function getGenerator()
 {
     if (null !== $this->generator) {
         return $this->generator;
     }
     if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
         $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger);
     } else {
         $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'] . '/' . $this->options['generator_cache_class'] . '.php', function (ConfigCacheInterface $cache) {
             $dumper = $this->getGeneratorDumperInstance();
             $options = array('class' => $this->options['generator_cache_class'], 'base_class' => $this->options['generator_base_class']);
             $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
         });
         require_once $cache->getPath();
         $this->generator = new $this->options['generator_cache_class']($this->context, $this->logger);
     }
     if ($this->generator instanceof ConfigurableRequirementsInterface) {
         $this->generator->setStrictRequirements($this->options['strict_requirements']);
     }
     return $this->generator;
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:26,代码来源:Router.php

示例3: getGenerator

 /**
  * Gets the UrlGenerator instance associated with this Router.
  *
  * @return UrlGeneratorInterface A UrlGeneratorInterface instance
  */
 public function getGenerator()
 {
     if (null !== $this->generator) {
         return $this->generator;
     }
     if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
         $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger);
     } else {
         $class = $this->options['generator_cache_class'];
         $cache = new ConfigCache($this->options['cache_dir'] . '/' . $class . '.php', $this->options['debug']);
         if (!$cache->isFresh($class)) {
             $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection());
             $options = array('class' => $class, 'base_class' => $this->options['generator_base_class']);
             $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
         }
         require_once $cache;
         $this->generator = new $class($this->context, $this->logger);
     }
     if ($this->generator instanceof ConfigurableRequirementsInterface) {
         $this->generator->setStrictRequirements($this->options['strict_requirements']);
     }
     return $this->generator;
 }
开发者ID:netvlies,项目名称:symfony,代码行数:28,代码来源:Router.php

示例4: setStrictRequirements

 /**
  * {@inheritdoc}
  */
 public function setStrictRequirements($enabled)
 {
     if ($this->wrapped instanceof ConfigurableRequirementsInterface) {
         $this->wrapped->setStrictRequirements($enabled);
     }
 }
开发者ID:AnimalDesign,项目名称:bolt-translate,代码行数:9,代码来源:LocalizedUrlGenerator.php


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