Symfony\Component\Routing\RouteCollection::getPrefix PHP Méthode

getPrefix() public méthode

Returns the prefix that may contain placeholders.
public getPrefix ( ) : string
Résultat string The prefix
    public function getPrefix()
    {
        return $this->prefix;
    }

Usage Example

Exemple #1
0
 /**
  * Replaces placeholders with service container parameter values in:
  * - the route defaults,
  * - the route requirements,
  * - the route pattern.
  *
  * @param RouteCollection $collection
  */
 private function resolveParameters(RouteCollection $collection)
 {
     foreach ($collection as $route) {
         if ($route instanceof RouteCollection) {
             $this->resolveParameters($route);
         } else {
             foreach ($route->getDefaults() as $name => $value) {
                 $route->setDefault($name, $this->resolveString($value));
             }
             foreach ($route->getRequirements() as $name => $value) {
                 $route->setRequirement($name, $this->resolveString($value));
             }
             $collection->setPrefix('/' . ltrim($this->resolveString($collection->getPrefix()), '/'));
             $route->setPattern($this->resolveString($route->getPattern()));
         }
     }
 }
All Usage Examples Of Symfony\Component\Routing\RouteCollection::getPrefix