fit = $fit; // Support case-insensitive route matching by ensuring the pattern outline // is lowercase. // @see \Drupal\Core\Routing\RouteProvider::getRoutesByPath() $this->patternOutline = mb_strtolower($pattern_outline); $this->numParts = $num_parts; } /** * 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 number of parts in this route's path. * * The string "foo/bar/baz" has 3 parts, regardless of how many of them are * placeholders. * * @return int * The number of parts in the path. */ public function getNumParts() { return $this->numParts; } /** * 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; } /** * {@inheritdoc} */ public function __serialize(): array { // Calling the parent method is safer than trying to optimize out the extra // function calls. $data = parent::__serialize(); $data['fit'] = $this->fit; $data['patternOutline'] = $this->patternOutline; $data['numParts'] = $this->numParts; return $data; } /** * {@inheritdoc} */ public function __unserialize(array $data): void { parent::__unserialize($data); $this->fit = $data['fit']; $this->patternOutline = $data['patternOutline']; $this->numParts = $data['numParts']; } }