Make CompiledRoute its own class rather than extending Symfony's CompiledRoute.
parent
f14521489a
commit
81c3bf6dff
|
@ -2,13 +2,12 @@
|
|||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
||||
use Symfony\Component\Routing\CompiledRoute as SymfonyCompiledRoute;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Description of CompiledRoute
|
||||
*/
|
||||
class CompiledRoute extends SymfonyCompiledRoute {
|
||||
class CompiledRoute {
|
||||
|
||||
/**
|
||||
* The fitness of this route.
|
||||
|
@ -25,7 +24,20 @@ class CompiledRoute extends SymfonyCompiledRoute {
|
|||
protected $patternOutline;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* The Route object of which this object is the compiled version.
|
||||
*
|
||||
* @var Symfony\Component\Routing\Route
|
||||
*/
|
||||
protected $route;
|
||||
|
||||
protected $variables;
|
||||
protected $tokens;
|
||||
protected $staticPrefix;
|
||||
protected $regex;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new CompiledRoute object.
|
||||
*
|
||||
* @param Route $route
|
||||
* A original Route instance.
|
||||
|
@ -35,22 +47,81 @@ class CompiledRoute extends SymfonyCompiledRoute {
|
|||
* The pattern outline for this route.
|
||||
*/
|
||||
public function __construct(Route $route, $fit, $pattern_outline) {
|
||||
// We're ignoring the rest of this stuff; really this should be just using
|
||||
// an interface, but the Symfony component doesn't have one. This is a bug
|
||||
// in Symfony.
|
||||
parent::__construct($route, '', '', array(), array());
|
||||
|
||||
$this->route = $route;
|
||||
$this->fit = $fit;
|
||||
$this->patternOutline = $pattern_outline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fit of this route
|
||||
*
|
||||
* See RouteCompiler for a definition of how the fit is calculated.
|
||||
*
|
||||
* @return int
|
||||
* The fit of the route.
|
||||
*/
|
||||
public function getFit() {
|
||||
return $this->fit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern outline of this route.
|
||||
*
|
||||
* The pattern outline of a route is the path pattern of the route, but
|
||||
* normalized such that all placeholders are replaced with %.
|
||||
*
|
||||
* @return string
|
||||
* The normalized path pattern.
|
||||
*/
|
||||
public function getPatternOutline() {
|
||||
return $this->patternOutline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Route instance.
|
||||
*
|
||||
* @return Route
|
||||
* A Route instance
|
||||
*/
|
||||
public function getRoute() {
|
||||
return $this->route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern.
|
||||
*
|
||||
* @return string The pattern
|
||||
*/
|
||||
public function getPattern() {
|
||||
return $this->route->getPattern();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the options.
|
||||
*
|
||||
* @return array The options
|
||||
*/
|
||||
public function getOptions() {
|
||||
return $this->route->getOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaults.
|
||||
*
|
||||
* @return array The defaults
|
||||
*/
|
||||
public function getDefaults() {
|
||||
return $this->route->getDefaults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requirements.
|
||||
*
|
||||
* @return array The requirements
|
||||
*/
|
||||
public function getRequirements() {
|
||||
return $this->route->getRequirements();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue