class Link extends AbstractType implements NodeInterface, TypeInterface, SetLoggerInterface (View source)

A type model for a Link element.

Traits

Shared code for working with the logger.

Properties

protected LoggerInterface $logger A PSR-3 logger. from LoggerTrait
protected DOMNode $node The DOMNode element to parse.
protected string $href The link's remote location.
protected string $rel The link's relationship to the current document.
protected string $type The link's media type.
protected string $hreflang The language of the link's remote location.
protected string $title The link's title.
protected int $length The link's length, in bytes (e.g., if it is a large file or direct download).

Methods

__call(string $nodeName, array $args)

Proxy method which forwards requests to an underlying handler.

string
getUnresolvableMessage(string $nodeName)

Gets the standard, pre-formatted message for unresolvable method calls.

setLogger(LoggerInterface $logger)

Sets the PSR-3 logger.

getLogger()

Retrieves the PSR-3 logger.

__construct(DOMNode|null $node = null, LoggerInterface $logger = null)

Constructs a new instance of this class.

string
__toString()

Converts this object into a string representation.

DOMNode|null
getNode()

Gets the DOMNode element.

string
getAlias(string $nodeName)

Finds the common internal alias for a given method name.

getHandler(string $nodeName, array $args = [])

Get the correct handler for a whitelisted method name.

getHref()

Alias for getUrl().

getHrefLang()

Alias for getLanguage().

getLang()

Alias for getLanguage().

getLanguage()

Returns the language of the Link.

getLength()

Returns the length of the Link, in bytes.

getMediaType()

Returns the media type (née mime type) of the Link.

getRel()

Alias for getRelationship().

getRelationship()

Returns the relationship of the Link.

getTitle()

Returns the title of the Link.

getType()

Alias for getMediaType().

getUri()

Alias for getUrl().

getUrl()

Returns the URL of the Link.

Details

__call(string $nodeName, array $args)

Proxy method which forwards requests to an underlying handler.

Parameters

string $nodeName The name of the method being called.
array $args Any arguments passed into that method.

protected string getUnresolvableMessage(string $nodeName)

Gets the standard, pre-formatted message for unresolvable method calls.

Parameters

string $nodeName The short version of the call (without the get).

Return Value

string

LoggerTrait setLogger(LoggerInterface $logger)

Sets the PSR-3 logger.

Parameters

LoggerInterface $logger A PSR-3 compatible logger.

Return Value

LoggerTrait

LoggerInterface getLogger()

Retrieves the PSR-3 logger.

Return Value

LoggerInterface

__construct(DOMNode|null $node = null, LoggerInterface $logger = null)

Constructs a new instance of this class.

Parameters

DOMNode|null $node The DOMNode element to parse.
LoggerInterface $logger The PSR-3 logger.

string __toString()

Converts this object into a string representation.

Return Value

string

DOMNode|null getNode()

Gets the DOMNode element.

Return Value

DOMNode|null

string getAlias(string $nodeName)

Finds the common internal alias for a given method name.

Parameters

string $nodeName The name of the method being called.

Return Value

string

Node getHandler(string $nodeName, array $args = [])

Get the correct handler for a whitelisted method name.

Parameters

string $nodeName The name of the method being called.
array $args The parameters which are passed to the method.

Return Value

Node

Exceptions

SimplePieException

Node getHref()

Alias for getUrl().

Return Value

Node

Node getHrefLang()

Alias for getLanguage().

Return Value

Node

Node getLang()

Alias for getLanguage().

Return Value

Node

Node getLanguage()

Returns the language of the Link.

Return Value

Node

Node getLength()

Returns the length of the Link, in bytes.

Return Value

Node

Node getMediaType()

Returns the media type (née mime type) of the Link.

Return Value

Node

Node getRel()

Alias for getRelationship().

Return Value

Node

Node getRelationship()

Returns the relationship of the Link.

Return Value

Node

Node getTitle()

Returns the title of the Link.

Return Value

Node

Node getType()

Alias for getMediaType().

Return Value

Node

Node getUri()

Alias for getUrl().

Return Value

Node

Node getUrl()

Returns the URL of the Link.

Return Value

Node