$requirements Array of regexes mapped to the path parameters. * @param ?array $defaults Array of default values mapped to the path parameters. * @param ?string $root Custom root. For OCS all apps are allowed, but for index.php only some can use it. * @param ?string $postfix Postfix for the route name. * @since 29.0.0 */ public function __construct( protected string $type, protected string $verb, protected string $url, protected ?array $requirements = null, protected ?array $defaults = null, protected ?string $root = null, protected ?string $postfix = null, ) { } /** * @return array{ * verb: string, * url: string, * requirements?: array, * defaults?: array, * root?: string, * postfix?: string, * } * @since 29.0.0 */ public function toArray() { $route = [ 'verb' => $this->verb, 'url' => $this->url, ]; if ($this->requirements !== null) { $route['requirements'] = $this->requirements; } if ($this->defaults !== null) { $route['defaults'] = $this->defaults; } if ($this->root !== null) { $route['root'] = $this->root; } if ($this->postfix !== null) { $route['postfix'] = $this->postfix; } return $route; } /** * @since 29.0.0 */ public function getType(): string { return $this->type; } /** * @since 29.0.0 */ public function getVerb(): string { return $this->verb; } /** * @since 29.0.0 */ public function getUrl(): string { return $this->url; } /** * @since 29.0.0 */ public function getRequirements(): ?array { return $this->requirements; } /** * @since 29.0.0 */ public function getDefaults(): ?array { return $this->defaults; } /** * @since 29.0.0 */ public function getRoot(): ?string { return $this->root; } /** * @since 29.0.0 */ public function getPostfix(): ?string { return $this->postfix; } }