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