Atom
class Atom extends AbstractXmlMiddleware implements XmlInterface, SetLoggerInterface (View source)
Support for the Atom 1.0 grammar.
Traits
Properties
protected LoggerInterface | $logger | A PSR-3 logger. | from LoggerTrait |
protected callable | $fn | A callable which is used to determine whether or not to run this middleware. | from AbstractMiddleware |
protected bool | $caseSensitive | The status of case-sensitivity. | from AbstractXmlMiddleware |
Methods
Constructs a new instance of this class.
Checks whether or not a particular property exists on an object, and if not, instantiates it as an array.
Return the value of an associative array key, if it exists. If not, return $default.
By default, SimplePie NG is case-sensitive (as per the specification). If an invalid feed is parsed that does not follow the specification with regard to casing of XML elements, this method allows you to trade some performance in favor of case-insensitive parsing.
Replace all instances of %s
with the $namespaceAlias
parameter.
Produce an XPath 1.0 expression which is used to query XML document nodes.
Gets the list of supported namespaces and their namespace aliases.
Fetches attributes with a single, scalar value, on elements.
Fetches elements with a single, scalar value.
Fetches elements with a single, complex value.
Fetches elements with a multiple, complex values.
Details
in LoggerTrait at line 35
LoggerTrait
setLogger(LoggerInterface $logger)
Sets the PSR-3 logger.
in LoggerTrait at line 52
LoggerInterface
getLogger()
Retrieves the PSR-3 logger.
in AbstractMiddleware at line 45
__construct(callable|null $fn = null)
Constructs a new instance of this class.
Accepts a callable with the following function signature:
function () {}
in AbstractMiddleware at line 58
void
addArrayProperty(mixed $object, string $property)
Checks whether or not a particular property exists on an object, and if not, instantiates it as an array.
in AbstractMiddleware at line 72
get(array $arr, string $key, mixed $default = null)
Return the value of an associative array key, if it exists. If not, return $default.
in AbstractXmlMiddleware at line 38
AbstractXmlMiddleware
setCaseInsensitive(bool $makeInsensitive = true)
By default, SimplePie NG is case-sensitive (as per the specification). If an invalid feed is parsed that does not follow the specification with regard to casing of XML elements, this method allows you to trade some performance in favor of case-insensitive parsing.
in AbstractXmlMiddleware at line 53
string
applyNsToQuery(string $query, string $namespaceAlias)
Replace all instances of %s
with the $namespaceAlias
parameter.
This is similar to sprintf()
, but the $namespaceAlias
is applied to all instances of %s
.
in AbstractXmlMiddleware at line 77
string
generateQuery(string $namespaceAlias, array $path)
Produce an XPath 1.0 expression which is used to query XML document nodes.
['feed', 'entry', 5, 'id', '@xml:lang']
/feed/entry[5]/id/@xml:lang (simplified)
at line 33
void
__invoke(stdClass $feedRoot, string $namespaceAlias, DOMXPath $xpath)
The function signature for the middleware.
at line 84
array
getSupportedNamespaces()
Gets the list of supported namespaces and their namespace aliases.
Returns an associative array where the key is the XML Namespace URL, and the value is the friendly alias name that the middleware can use to refer to it.
return [
'http://www.w3.org/2005/Atom' => 'atom10'
];
at line 106
protected void
getNodeAttributes(object $feedRoot, string $namespaceAlias, DOMXPath $xpath, array $path, array $fallback = [])
Fetches attributes with a single, scalar value, on elements.
at line 150
protected void
getSingleScalarTypes(object $feedRoot, string $namespaceAlias, DOMXPath $xpath, array $path, array $fallback = [])
Fetches elements with a single, scalar value.