Symfony\Component\Routing\RouteCompiler
val1
diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
index 8800e8985406d..73d11450bea31 100644
--- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
+++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
@@ -201,7 +201,8 @@ protected function addRoute(RouteCollection $collection, $annot, array $globals,
}
foreach ($paths as $locale => $path) {
- $route = $this->createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
+ $route = $this->createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods,
+ $condition, $priority);
$this->configureRoute($route, $class, $method, $annot);
if (0 !== $locale) {
$route->setDefault('_locale', $locale);
@@ -325,9 +326,10 @@ private function resetGlobals(): array
];
}
- protected function createRoute(string $path, array $defaults, array $requirements, array $options, ?string $host, array $schemes, array $methods, ?string $condition)
+ protected function createRoute(string $path, array $defaults, array $requirements, array $options, ?string $host,
+ array $schemes, array $methods, ?string $condition, ?int $priority)
{
- return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
+ return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition, $priority);
}
abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot);
diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php
index 3b4d04c36db75..dbf48ca8db153 100644
--- a/src/Symfony/Component/Routing/Route.php
+++ b/src/Symfony/Component/Routing/Route.php
@@ -27,6 +27,7 @@ class Route implements \Serializable
private $requirements = [];
private $options = [];
private $condition = '';
+ private $priority = 0;
/**
* @var CompiledRoute|null
@@ -49,8 +50,11 @@ class Route implements \Serializable
* @param string|string[] $schemes A required URI scheme or an array of restricted schemes
* @param string|string[] $methods A required HTTP method or an array of restricted methods
* @param string|null $condition A condition that should evaluate to true for the route to match
+ * @param int|null $priority
*/
- public function __construct(string $path, array $defaults = [], array $requirements = [], array $options = [], ?string $host = '', $schemes = [], $methods = [], ?string $condition = '')
+ public function __construct(string $path, array $defaults = [], array $requirements = [], array $options = [],
+ ?string $host = '', $schemes = [], $methods = [], ?string $condition = '', ?int
+ $priority = 0)
{
$this->setPath($path);
$this->addDefaults($defaults);
@@ -60,6 +64,7 @@ public function __construct(string $path, array $defaults = [], array $requireme
$this->setSchemes($schemes);
$this->setMethods($methods);
$this->setCondition($condition);
+ $this->setPriority($priority);
}
public function __serialize(): array
@@ -74,6 +79,7 @@ public function __serialize(): array
'methods' => $this->methods,
'condition' => $this->condition,
'compiled' => $this->compiled,
+ 'priority' => $this->priority,
];
}
@@ -101,6 +107,7 @@ public function __unserialize(array $data): void
if (isset($data['compiled'])) {
$this->compiled = $data['compiled'];
}
+ $this->priority = $data['priority'];
}
/**
@@ -507,6 +514,29 @@ public function setCondition(?string $condition)
return $this;
}
+ /**
+ * Returns the priority.
+ *
+ * @return integer The priority
+ */
+ public function getPriority(): ?int
+ {
+ return $this->priority;
+ }
+
+ /**
+ * Sets the priority.
+ *
+ * @return $this
+ */
+ public function setPriority(?int $priority)
+ {
+ $this->priority = (int) $priority;
+ $this->compiled = null;
+
+ return $this;
+ }
+
/**
* Compiles the route.
*
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy