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


PHP Route::getOptions方法代码示例

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


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

示例1: testOptions

 public function testOptions()
 {
     $route = new Route('/{foo}');
     $route->setOptions(array('foo' => 'bar'));
     $this->assertEquals(array_merge(array('segment_separators' => array('/', '.'), 'text_regex' => '.+?', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options');
     $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface');
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:7,代码来源:RouteTest.php

示例2: testOptions

 public function testOptions()
 {
     $route = new Route('/{foo}');
     $route->setOptions(array('foo' => 'bar'));
     $this->assertEquals(array_merge(array('compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options');
     $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface');
     $route->setOptions(array('foo' => 'foo'));
     $route->addOptions(array('bar' => 'bar'));
     $this->assertEquals($route, $route->addOptions(array()), '->addOptions() implements a fluent interface');
     $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), $route->getOptions(), '->addDefaults() keep previous defaults');
 }
开发者ID:omusico,项目名称:lafayettehelps.com,代码行数:11,代码来源:RouteTest.php

示例3: getOptions

 /**
  * {@inheritDoc}
  *
  * Handling the missing default 'compiler_class'
  * @see setOptions
  */
 public function getOptions()
 {
     $options = parent::getOptions();
     if (!array_key_exists('compiler_class', $options)) {
         $options['compiler_class'] = 'Symfony\\Component\\Routing\\RouteCompiler';
     }
     foreach ($options as $key => $value) {
         if ($this->isBooleanOption($key)) {
             $options[$key] = (bool) $value;
         }
     }
     return $options;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:19,代码来源:Route.php

示例4: getOptions

 /**
  * {@inheritDoc}
  *
  * Handling the missing default 'compiler_class'
  * @see setOptions
  */
 public function getOptions()
 {
     $options = parent::getOptions();
     if (!array_key_exists('compiler_class', $options)) {
         $options['compiler_class'] = 'Symfony\\Component\\Routing\\RouteCompiler';
     }
     return $options;
 }
开发者ID:symfony-cmf,项目名称:routing-extra-bundle,代码行数:14,代码来源:Route.php

示例5: setOptions

 /**
  * Set the options
  *
  * @param array $options
  * @return Route
  */
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     $this->options = parent::getOptions();
     return $this;
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:12,代码来源:Route.php

示例6: assertMatchingRoute

 /**
  * Asserts that a route object has the expected properties.
  *
  * @param \Symfony\Component\Routing\Route $route
  *   The route to test.
  * @param string $expected_path
  *   The expected path for the route.
  * @param array $expected_defaults
  *   The expected defaults for the route.
  * @param array $expected_requirements
  *   The expected requirements for the route.
  * @param array $expected_options
  *   The expected options for the route.
  */
 protected function assertMatchingRoute(Route $route, $expected_path, $expected_defaults, $expected_requirements, $expected_options)
 {
     $this->assertSame($expected_path, $route->getPath());
     $this->assertSame($expected_defaults, $route->getDefaults());
     $this->assertSame($expected_requirements, $route->getRequirements());
     $this->assertSame($expected_options, $route->getOptions());
 }
开发者ID:neeravbm,项目名称:unify-d8,代码行数:21,代码来源:PageManagerRoutesTest.php

示例7: getOptions

 /**
  * Returns the options.
  *
  * @return array
  *   The options.
  */
 public function getOptions()
 {
     return $this->route->getOptions();
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:10,代码来源:CompiledRoute.php

示例8: prependBundlePrefix

 /**
  * Prepends the bundle prefix to the route.
  *
  * @param Route $route
  * @param AbstractBundle $bundle
  *
  * We have to prepend the bundle prefix if
  * - routes are _not_ currently extracted via the command line and
  * - the route has i18n set to false.
  * This is because when extracting the routes, a bundle author only wants to translate the bare route
  * patterns, without a redundant and potentially customized bundle prefix in front of them.
  * If i18n is set to true, Zikula's customized pattern generation strategy will take care of it.
  * See Zikula\RoutesModule\Translation\ZikulaPatternGenerationStrategy
  */
 private function prependBundlePrefix(Route $route, AbstractBundle $bundle)
 {
     $prefix = '';
     $options = $route->getOptions();
     $prependBundle = !isset($GLOBALS['translation_extract_routes']) && isset($options['i18n']) && !$options['i18n'];
     if ($prependBundle && (!isset($options['zkNoBundlePrefix']) || !$options['zkNoBundlePrefix'])) {
         // get url from MetaData first. May be empty.
         $untranslatedPrefix = $bundle->getMetaData()->getUrl(false);
         if (empty($untranslatedPrefix)) {
             try {
                 // MetaData will be empty for extensions not Spec-2.0. Try to get from modinfo.
                 // this calls the DB which is not available during install.
                 $modinfo = \ModUtil::getInfoFromName($bundle->getName());
                 $prefix = $modinfo['url'];
             } catch (\Exception $e) {
             }
         } else {
             $locale = $this->container->getParameter('locale');
             if ($this->translator->getCatalogue($locale)->has($untranslatedPrefix, strtolower($bundle->getName()))) {
                 $prefix = $this->translator->trans($untranslatedPrefix, [], strtolower($bundle->getName()), $locale);
             } else {
                 $prefix = $untranslatedPrefix;
             }
         }
         $path = "/" . $prefix . $route->getPath();
         $route->setPath($path);
     }
 }
开发者ID:Silwereth,项目名称:core,代码行数:42,代码来源:RouteLoader.php

示例9: cloneRoute

 /**
  * Makes a clone of the given Route object.
  *
  * @param Route $route
  *
  * @return Route
  */
 public function cloneRoute(Route $route)
 {
     return new Route($route->getPath(), $route->getDefaults(), $route->getRequirements(), $route->getOptions(), $route->getHost(), $route->getSchemes(), $route->getMethods());
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:RouteCollectionAccessor.php


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