EvolvableLinkInterface
extends
LinkInterface
in
An evolvable link value object.
Table of Contents
Methods
- getAttributes() : array<string|int, mixed>
- Returns a list of attributes that describe the target URI.
- getHref() : string
- Returns the target of the link.
- getRels() : array<string|int, string>
- Returns the relationship type(s) of the link.
- isTemplated() : bool
- Returns whether or not this is a templated link.
- withAttribute() : static
- Returns an instance with the specified attribute added.
- withHref() : static
- Returns an instance with the specified href.
- withoutAttribute() : static
- Returns an instance with the specified attribute excluded.
- withoutRel() : static
- Returns an instance with the specified relationship excluded.
- withRel() : static
- Returns an instance with the specified relationship included.
Methods
getAttributes()
Returns a list of attributes that describe the target URI.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —A key-value list of attributes, where the key is a string and the value is either a PHP primitive or an array of PHP strings. If no values are found an empty array MUST be returned.
getHref()
Returns the target of the link.
public
getHref() : string
The target link must be one of:
- An absolute URI, as defined by RFC 5988.
- A relative URI, as defined by RFC 5988. The base of the relative link is assumed to be known based on context by the client.
- A URI template as defined by RFC 6570.
If a URI template is returned, isTemplated() MUST return True.
Return values
stringgetRels()
Returns the relationship type(s) of the link.
public
getRels() : array<string|int, string>
This method returns 0 or more relationship types for a link, expressed as an array of strings.
Return values
array<string|int, string>isTemplated()
Returns whether or not this is a templated link.
public
isTemplated() : bool
Return values
bool —True if this link object is templated, False otherwise.
withAttribute()
Returns an instance with the specified attribute added.
public
withAttribute(string $attribute, string|Stringable|int|float|bool|array<string|int, mixed> $value) : static
If the specified attribute is already present, it will be overwritten with the new value.
Parameters
- $attribute : string
-
The attribute to include.
- $value : string|Stringable|int|float|bool|array<string|int, mixed>
-
The value of the attribute to set.
Return values
staticwithHref()
Returns an instance with the specified href.
public
withHref(string|Stringable $href) : static
Parameters
- $href : string|Stringable
-
The href value to include. It must be one of: - An absolute URI, as defined by RFC 5988. - A relative URI, as defined by RFC 5988. The base of the relative link is assumed to be known based on context by the client. - A URI template as defined by RFC 6570. - An object implementing __toString() that produces one of the above values.
An implementing library SHOULD evaluate a passed object to a string immediately rather than waiting for it to be returned later.
Return values
staticwithoutAttribute()
Returns an instance with the specified attribute excluded.
public
withoutAttribute(string $attribute) : static
If the specified attribute is not present, this method MUST return normally without errors.
Parameters
- $attribute : string
-
The attribute to remove.
Return values
staticwithoutRel()
Returns an instance with the specified relationship excluded.
public
withoutRel(string $rel) : static
If the specified rel is already not present, this method MUST return normally without errors.
Parameters
- $rel : string
-
The relationship value to exclude.
Return values
staticwithRel()
Returns an instance with the specified relationship included.
public
withRel(string $rel) : static
If the specified rel is already present, this method MUST return normally without errors, but without adding the rel a second time.
Parameters
- $rel : string
-
The relationship value to add.