ArrayUrlRegistry
in package
implements
UrlRegistry
Provides an array backed URL registry implementation.
Table of Contents
Interfaces
- UrlRegistry
- Provides an interface for defining a URL registry.
Methods
- format() : string
- Format a URL.
- register() : void
- Registers a URL format.
- scopeTo() : UrlRegistry
- Creates a scoped URL registry.
Methods
format()
Format a URL.
public
format(string $name[, array<string|int, mixed> $vars = [] ][, bool $spacesAsPlus = false ]) : string
Parameters
- $name : string
-
Name of the URL to format.
- $vars : array<string|int, mixed> = []
-
Values to replace the variables in the path, query and fragment with.
- $spacesAsPlus : bool = false
-
Whether to represent spaces as a + instead of %20.
Return values
string —Formatted URL.
register()
Registers a URL format.
public
register(UrlSource|string $nameOrSource[, string $path = '' ][, array<string|int, mixed> $query = [] ][, string $fragment = '' ]) : void
TODO: explain formatting system
Parameters
- $nameOrSource : UrlSource|string
-
Name of the format or a URL source object.
- $path : string = ''
-
Path portion of the URL. Required if $nameOrSource is a name string.
- $query : array<string|int, mixed> = []
-
Query string variables of the URL.
- $fragment : string = ''
-
Fragment portion of the URL.
scopeTo()
Creates a scoped URL registry.
public
scopeTo([string $namePrefix = '' ][, string $pathPrefix = '' ]) : UrlRegistry
Parameters
- $namePrefix : string = ''
-
String to prefix names in the scope with.
- $pathPrefix : string = ''
-
String to prefix paths in the scope with, must start with / if not empty.
Return values
UrlRegistry —A scoped URL registry.