class Entry extends AbstractType implements NodeInterface, BranchInterface, SetLoggerInterface (View source)

A type model for an Entry element.

Traits

Shared code for working with elements which manage dates.
Shared code for working with deeply-nested elements for types.
Shared code for working with the logger.

Properties

protected string $createFromFormat The format that should be used when determining how to parse a date from a date string. from DateTrait
protected string $outputTimezone The preferred timezone to use for date output. from DateTrait
protected string $namespaceAlias The preferred namespace alias for a given XML namespace URI. Should be the result of a call to SimplePie\Util\Ns.
protected LoggerInterface $logger A PSR-3 logger. from LoggerTrait
protected DOMNode $node The DOMNode element to parse.

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.

setDateFormat(string $createFromFormat)

Allows the user to help the date parser by providing the format of the datestamp in the feed.

from DateTrait
setOutputTimezone(string $timezone = 'UTC')

Set the preferred output timezone.

from DateTrait
getScalarSingleValue(object $root, string $nodeName, string|null $namespaceAlias = null)

Retrieves nodes that are simple scalars, and there is only one allowed value.

getComplexSingleValue(object $root, string $nodeName, string $className, string|null $namespaceAlias = null)

Retrieves nodes that are complex types, and there is only one allowed value.

iterable
getComplexMultipleValues(object $root, string $nodeName, string|null $namespaceAlias = null)

Retrieves nodes that are complex types, and there may be are more than one value.

setLogger(LoggerInterface $logger)

Sets the PSR-3 logger.

getLogger()

Retrieves the PSR-3 logger.

__construct(string $namespaceAlias, 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.

array
getAuthors(string $namespaceAlias)

Returns the Authors associated with this entry.

array
getCategories(string $namespaceAlias)

Returns the list of Categories/Tags/Topics associated with this entry.

getContent(string $namespaceAlias)

Returns the content of the entry, serialized as TEXT, HTML, or XHTML content.

array
getContributors(string $namespaceAlias)

Returns the list of Contributors associated with this entry.

getCopyright(string $namespaceAlias)

Alias for getRights().

getGuid(string $namespaceAlias)

Alias for getId().

getId(string $namespaceAlias)

Returns the ID associated with this entry.

getLang(string $namespaceAlias)

Alias for getLanguage().

getLanguage(string $namespaceAlias)

Returns the language associated with this entry.

array
getLinks(string $namespaceAlias, string $relFilter)

Returns the list of Links associated with this entry.

getPubDate(string $namespaceAlias)

Alias for getPublished().

getPublished(string $namespaceAlias)

Returns the date that the entry was published.

getRights(string $namespaceAlias)

Returns the copyright information associated with this entry.

getSummary(string $namespaceAlias)

Returns the summary associated with this entry.

getTitle(string $namespaceAlias)

Returns the title associated with this entry.

getUpdated(string $namespaceAlias)

Returns the date that the entry was updated.

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

DateTrait setDateFormat(string $createFromFormat)

Allows the user to help the date parser by providing the format of the datestamp in the feed.

This will be passed into DateTime::createFromFormat() at parse-time.

Parameters

string $createFromFormat The format of the datestamp in the feed.

Return Value

DateTrait

See also

http://php.net/manual/en/datetime.createfromformat.php

DateTrait setOutputTimezone(string $timezone = 'UTC')

Set the preferred output timezone.

This calculation is performed on a best-effort basis and is not guaranteed. Factors which may affect the calculation include:

  • the version of glibc/musl that your OS relies on
  • the freshness of the timestamp data your OS relies on
  • the format of the datestamp inside of the feed and PHP's ability to parse it

Parameters

string $timezone The timezone identifier to use. Must be compatible with DateTimeZone. The default value is UTC.

Return Value

DateTrait

protected Node getScalarSingleValue(object $root, string $nodeName, string|null $namespaceAlias = null)

Retrieves nodes that are simple scalars, and there is only one allowed value.

Parameters

object $root The root node for performing the lookup. Expected to be either a stdClass (for Feed), or an SimplePie\Type\Entry instance.
string $nodeName The name of the tree node to retrieve. Available tree nodes can be viewed by looking at the response from getRoot().
string|null $namespaceAlias The XML namespace alias to apply.

Return Value

Node

protected TypeInterface getComplexSingleValue(object $root, string $nodeName, string $className, string|null $namespaceAlias = null)

Retrieves nodes that are complex types, and there is only one allowed value.

Parameters

object $root The root node for performing the lookup. Expected to be either a stdClass (for Feed), or an SimplePie\Type\Entry instance.
string $nodeName The name of the tree node to retrieve. Available tree nodes can be viewed by looking at the response from getRoot().
string $className The class name to instantiate when there is not a defined value.
string|null $namespaceAlias The XML namespace alias to apply.

Return Value

TypeInterface

protected iterable getComplexMultipleValues(object $root, string $nodeName, string|null $namespaceAlias = null)

Retrieves nodes that are complex types, and there may be are more than one value.

Parameters

object $root The root node for performing the lookup. Expected to be either a stdClass (for Feed), or an SimplePie\Type\Entry instance.
string $nodeName The name of the tree node to retrieve. Available tree nodes can be viewed by looking at the response from getRoot().
string|null $namespaceAlias The XML namespace alias to apply.

Return Value

iterable

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(string $namespaceAlias, DOMNode|null $node = null, LoggerInterface $logger = null)

Constructs a new instance of this class.

Parameters

string $namespaceAlias [description]
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 arguments that are passed to the method.

Return Value

Node

Exceptions

SimplePieException

array getAuthors(string $namespaceAlias)

Returns the Authors associated with this entry.

Parameters

string $namespaceAlias

Return Value

array

array getCategories(string $namespaceAlias)

Returns the list of Categories/Tags/Topics associated with this entry.

Parameters

string $namespaceAlias

Return Value

array

Node getContent(string $namespaceAlias)

Returns the content of the entry, serialized as TEXT, HTML, or XHTML content.

Parameters

string $namespaceAlias

Return Value

Node

array getContributors(string $namespaceAlias)

Returns the list of Contributors associated with this entry.

Parameters

string $namespaceAlias

Return Value

array

Node getCopyright(string $namespaceAlias)

Alias for getRights().

Parameters

string $namespaceAlias

Return Value

Node

Node getGuid(string $namespaceAlias)

Alias for getId().

Parameters

string $namespaceAlias

Return Value

Node

Node getId(string $namespaceAlias)

Returns the ID associated with this entry.

Parameters

string $namespaceAlias

Return Value

Node

Node getLang(string $namespaceAlias)

Alias for getLanguage().

Parameters

string $namespaceAlias

Return Value

Node

Node getLanguage(string $namespaceAlias)

Returns the language associated with this entry.

Parameters

string $namespaceAlias

Return Value

Node

Returns the list of Links associated with this entry.

Parameters

string $namespaceAlias
string $relFilter

Return Value

array

DateTime getPubDate(string $namespaceAlias)

Alias for getPublished().

Parameters

string $namespaceAlias

Return Value

DateTime

DateTime getPublished(string $namespaceAlias)

Returns the date that the entry was published.

Parameters

string $namespaceAlias

Return Value

DateTime

Node getRights(string $namespaceAlias)

Returns the copyright information associated with this entry.

Parameters

string $namespaceAlias

Return Value

Node

Node getSummary(string $namespaceAlias)

Returns the summary associated with this entry.

Parameters

string $namespaceAlias

Return Value

Node

Node getTitle(string $namespaceAlias)

Returns the title associated with this entry.

Parameters

string $namespaceAlias

Return Value

Node

DateTime getUpdated(string $namespaceAlias)

Returns the date that the entry was updated.

Parameters

string $namespaceAlias

Return Value

DateTime