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


PHP Route::getName方法代码示例

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


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

示例1: __construct

 /**
  * constructor
  *
  * @param \Naquadria\Components\Routing\Route $route
  * @param array $routeData
  * @param array $replacer
  */
 public function __construct(Route $route, array $routeData, array $replacer)
 {
     $this->name = $route->getName();
     $this->abstraction = $route->getAbstraction();
     $this->data = $routeData;
     $this->replacer = $replacer;
     $this->route = $route;
 }
开发者ID:naquadria,项目名称:routing,代码行数:15,代码来源:RouteEntity.php

示例2: __construct

 /**
  * @param Route $route The unparsed route whose properties we are copying
  */
 public function __construct(Route $route)
 {
     parent::__construct($route->getMethods(), $route->getRawPath(), $route->getController());
     $this->setName($route->getName());
     $this->setRawHost($route->getRawHost());
     $this->addMiddleware($route->getMiddleware());
     $this->setSecure($route->isSecure());
     $this->setVarRegexes($route->varRegexes);
 }
开发者ID:scaleddynamics,项目名称:Opulence,代码行数:12,代码来源:ParsedRoute.php

示例3: go

 public function go($path)
 {
     $asset = \Route::getName();
     $inputfile = HOME_DIR . '/templates/' . \App::get('template') . '/' . $asset . '/' . $path;
     $file = new \File($inputfile);
     if ($file->exists()) {
         $this->response->setMIME($file->detectMime())->out($file->get());
     }
 }
开发者ID:jankal,项目名称:mvc,代码行数:9,代码来源:EverythingHandler.php

示例4: __construct

 /**
  * RouteLink constructor.
  *
  * @param $params
  * @param \HBM\DatagridBundle\Model\Route $route
  */
 public function __construct($params, Route $route)
 {
     parent::__construct();
     $this->params = $params;
     if ($route !== NULL) {
         $this->name = $route->getName();
         $this->defaults = $route->getDefaults();
     }
 }
开发者ID:burdanews,项目名称:datagrid-bundle,代码行数:15,代码来源:RouteLink.php

示例5: map

 public function map($routeUrl, $target = '', array $args = array())
 {
     $route = new Route();
     $route->setUrl($this->basePath . $routeUrl);
     $route->setTarget($target);
     if (isset($args['methods'])) {
         $methods = explode(',', $args['methods']);
         $route->setMethods($methods);
     }
     if (isset($args['filters'])) {
         $route->setFilters($args['filters']);
     }
     if (isset($args['name'])) {
         $route->setName($args['name']);
         if (!isset($this->namedRoutes[$route->getName()])) {
             $this->namedRoutes[$route->getName()] = $route;
         }
     }
     $this->routes[] = $route;
 }
开发者ID:fermino,项目名称:TriviaTime,代码行数:20,代码来源:Router.php

示例6: compileRoute

 /**
  * {@inheritDoc}
  *
  * @throws RuntimeException
  */
 protected function compileRoute(Route $route)
 {
     $parameters = $this->processPathParameters($route->getPath());
     $regexp = $route->getPath();
     foreach ($parameters as $parameter) {
         if (substr_count($route->getPath(), '{' . $parameter . '}') > 1) {
             throw new \RuntimeException(sprintf('Route name "%s" cannot reference variable "%s" more than once.', $route->getName(), $parameter));
         }
         $regexp = str_replace('{' . $parameter . '}', '(?<' . $parameter . '>[A-z0-9_-]+)', $regexp);
     }
     $regexp = "#^{$regexp}\$#";
     return ['parameters' => $parameters, 'regexp' => $regexp];
 }
开发者ID:strident,项目名称:router,代码行数:18,代码来源:RouteMatcher.php

示例7: processRoute

 /**
  * @param array      $routeConfig
  * @param Route|null $parentRoute
  *
  * @return Route
  */
 private function processRoute(array $routeConfig, Route $parentRoute = null)
 {
     $name = $routeConfig['name'];
     $url = isset($routeConfig['options']['route']) ? $routeConfig['options']['route'] : '';
     $controller = isset($routeConfig['options']['defaults']['controller']) ? $routeConfig['options']['defaults']['controller'] : null;
     $action = isset($routeConfig['options']['defaults']['action']) ? $routeConfig['options']['defaults']['action'] : null;
     if (null !== $parentRoute) {
         $name = $parentRoute->getName() . '/' . $name;
         $url = $parentRoute->getUrl() . $url;
         if (null === $controller) {
             $controller = $parentRoute->getController();
         }
     }
     if (null === $action) {
         $action = 'index';
     }
     $action .= 'Action';
     return new Route($name, $url, $controller, $action);
 }
开发者ID:noiselabs,项目名称:zf-debug-utils,代码行数:25,代码来源:RouteCollectionBuilder.php

示例8: add

 public function add(Route $route)
 {
     $path = $route->getParsed()->getPathPattern();
     $method = $route->getMethod();
     if (!isset($this->pathMethodMap[$path])) {
         $this->pathMethodMap[$path] = [];
     } else {
         if (in_array($method, $this->pathMethodMap[$path])) {
             throw new \InvalidArgumentException("Method {$method} is already defined for {$path}");
         }
     }
     $name = $route->getName();
     if ($name !== null) {
         if (isset($this->routeNames[$name])) {
             throw new \InvalidArgumentException("Route {$name} is already defined");
         }
         $this->routeNames[$name] = $route;
     }
     $this->pathMethodMap[$path][] = $method;
     $this->routes[] = $route;
 }
开发者ID:bugadani,项目名称:routy,代码行数:21,代码来源:RouteContainer.php

示例9: setRoute

 public function setRoute(Route $route)
 {
     $this->add($route->getName(), $route->getMethod(), $route->getPath(), $route->getHandler());
 }
开发者ID:wispira,项目名称:framework,代码行数:4,代码来源:Router.php

示例10: addRoute

 /**
  * @param Route $route
  */
 public function addRoute(Route $route)
 {
     $this->routes[$route->getName()] = $route;
 }
开发者ID:noiselabs,项目名称:zf-debug-utils,代码行数:7,代码来源:FlatRouteCollection.php

示例11: testGetName

 public function testGetName()
 {
     $route = new Route("herp", "derp", "target");
     self::assertEquals("herp", $route->getName());
 }
开发者ID:apexstudios,项目名称:yamwlib,代码行数:5,代码来源:RouteTest.php

示例12: addRoute

 /**
  * Добавление роута в список роутов
  * @param Route $route
  */
 protected static function addRoute(Route $route)
 {
     static::$_routes[$route->getName()] = $route;
 }
开发者ID:ArmSALArmy,项目名称:Banants,代码行数:8,代码来源:Router.php

示例13: buildUrl

 /**
  * @param Route $route
  * @param array $params
  * @return string
  */
 protected function buildUrl(Route $route, array $params)
 {
     $targets = [];
     $replacements = [];
     foreach ($route->getVariableNames() as $key) {
         if (!isset($params[$key])) {
             throw new \InvalidArgumentException("Variable '{$key}' not found or null for route '{$route->getName()}'");
         }
         $targets[] = ":" . $key;
         $replacements[] = $params[$key];
     }
     return str_replace($targets, $replacements, $route->getUri());
 }
开发者ID:yusukezzz,项目名称:routing,代码行数:18,代码来源:Router.php


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