class Segment (View source)

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, string $separator = '/')

Segment constructor.

string
__toString()

No description

bool
matches(string $value)

Checks if $value matches this Segment.

int
getSegmentType()

No description

string|null
getKey()

No description

string|null
getValue()

No description

RelativeResourceTemplate|null
getTemplate()

No description

string
getSeparator()

No description

Details

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

Segment constructor.

Parameters

int $segmentType
string|null $value
string|null $key
RelativeResourceTemplate $template
string $separator The separator that belongs at the end of a segment. Ending segments should use '/'.

Exceptions

ValidationException

string __toString()

Return Value

string A string representation of the segment.

bool matches(string $value)

Checks if $value matches this Segment.

Parameters

string $value

Return Value

bool

Exceptions

ValidationException

int getSegmentType()

Return Value

int

string|null getKey()

Return Value

string|null

string|null getValue()

Return Value

string|null

RelativeResourceTemplate|null getTemplate()

Return Value

RelativeResourceTemplate|null

string getSeparator()

Return Value

string