class Segment

Represents a segment in a resource template. This is used internally by RelativeResourceTemplate, but is not intended for public use and may change without notice.

Constants

LITERAL_SEGMENT

WILDCARD_SEGMENT

DOUBLE_WILDCARD_SEGMENT

VARIABLE_SEGMENT

Methods

__construct(int $segmentType, string|null $value = null, string|null $key = null, RelativeResourceTemplate $template = null)

Segment constructor.

string
__toString()

No description

bindTo(string $value)

Checks if $value matches the current segment, and creates a new literal Segment with value equal to $value. If $value does not match the current Segment, throws a ValidationException.

bool
matches(string $value)

Checks if $value matches this Segment.

int
getSegmentType()

No description

string|null
getKey()

No description

string|null
getValue()

No description

getTemplate()

No description

Details

at line 72
__construct(int $segmentType, string|null $value = null, string|null $key = null, RelativeResourceTemplate $template = null)

Segment constructor.

Parameters

int $segmentType
string|null $value
string|null $key
RelativeResourceTemplate $template

Exceptions

ValidationException

at line 102
string __toString()

Return Value

string A string representation of the segment.

at line 115
Segment bindTo(string $value)

Checks if $value matches the current segment, and creates a new literal Segment with value equal to $value. If $value does not match the current Segment, throws a ValidationException.

Parameters

string $value

Return Value

Segment

Exceptions

ValidationException

at line 134
bool matches(string $value)

Checks if $value matches this Segment.

Parameters

string $value

Return Value

bool

Exceptions

ValidationException

at line 155
int getSegmentType()

Return Value

int

at line 163
string|null getKey()

Return Value

string|null

at line 171
string|null getValue()

Return Value

string|null

at line 179
RelativeResourceTemplate|null getTemplate()

Return Value

RelativeResourceTemplate|null