Object describing a link relation

 Methods

Create a link relation

__construct(string $relation) 
todo filtering and/or validation of relation string

Parameters

$relation

string

Retrieve the link relation

getRelation() : string

Returns

string

Return the route to be used to generate the link URL, if any

getRoute() : null | string

Returns

nullstring

Retrieve route assembly options, if any

getRouteOptions() : array

Returns

array

Retrieve route assembly parameters/substitutions, if any

getRouteParams() : array

Returns

array

Retrieve the link URL, if set

getUrl() : null | string

Returns

nullstring

Does the link have a route set?

hasRoute() : bool

Returns

bool

Does the link have a URL set?

hasUrl() : bool

Returns

bool

Is the link relation complete -- do we have either a URL or a route set?

isComplete() : bool

Returns

bool

Set the route to use when generating the relation URI

setRoute(string $route, null | array | \Traversable $params, null | array | \Traversable $options) : \PhlyRestfully\Link

If any params or options are passed, those will be passed to route assembly.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$route

string

$params

nullarray\Traversable

$options

nullarray\Traversable

Returns

Set route assembly options

setRouteOptions(array | \Traversable $options) : \PhlyRestfully\Link
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array\Traversable

Returns

Set route assembly parameters/substitutions

setRouteParams(array | \Traversable $params) : \PhlyRestfully\Link
fluent This method is part of a fluent interface and will return the same instance

Parameters

$params

array\Traversable

Returns

Set an explicit URL for the link relation

setUrl(string $url) : \PhlyRestfully\Link
fluent This method is part of a fluent interface and will return the same instance

Parameters

$url

string

Returns