Google API Core Client - Class PathTemplate (1.35.0)

Reference documentation and code samples for the Google API Core Client class PathTemplate.

Represents a path template.

Templates use the syntax of the API platform; see the protobuf of HttpRule for details. A template consists of a sequence of literals, wildcards, and variable bindings, where each binding can have a sub-path. A string representation can be parsed into an instance of PathTemplate, which can then be used to perform matching and instantiation.

Namespace

Google \ ApiCore

Methods

__construct

PathTemplate constructor.

Parameter
Name Description
path string

A path template string

__toString

Returns
Type Description
string A string representation of the path template

render

Renders a path template using the provided bindings.

Parameter
Name Description
bindings array

An array matching var names to binding strings.

Returns
Type Description
string A rendered representation of this path template.

matches

Check if $path matches a resource string.

Parameter
Name Description
path string

A resource string.

Returns
Type Description
bool

match

Matches a fully qualified path template string.

Parameter
Name Description
path string

A fully qualified path template string.

Returns
Type Description
array Array matching var names to binding values.