class Collection extends \JKingWeb\Lax\Collection {
protected static $ranks = [
'webmaster' => 10,
'editor' => 20,
'webmaster' => 10,
'editor' => 20,
'contributor' => 30,
'author' => 40,
'author' => 40,
];
/** Returns the collection formatted as an array of strings
*
*
* The $humanFriendly parameter controls whether or not an effort is made to return human-friendly category names. Only Atom categories have this distinction
*
*
*/
public function list(bool $humanFriendly = true) {
class Collection extends \JKingWeb\Lax\Collection {
/** Returns the primary ("best") enclosure of the collection
*
*
* Videos are preferred over audios, which are preferred over images, which are preferred over anything else
*
*
* Videos are first ranked by length, then resolution (total pixels), then bitrate, then size; audios are ranked by length, then bitrate, then size; images are ranked by resolution (total pixels), then size
@ -12,7 +12,7 @@ use JKingWeb\Lax\Enclosure\Collection as EnclosureCollection;
class Entry {
/** @var string $id The persistent identifier of the entry. This is often identical to the URL of the entry, but the latter may change
*
*
* While identifiers are usually supposed to be globally unique, in practice they are frequently only unique within the context of a particular newsfeed
*/
public $id;
@ -25,7 +25,7 @@ class Entry {
/** @var \JKingWeb\Lax\Text $title The title of the entry */
public $title;
/** @var \JKingWeb\Lax\Text $content The content of the entry
*
*
* This may be merely a summary or excerpt for many newsfeeds */
public $content;
/** @var \JKingWeb\Lax\Text $summary A short summary or excerpt of the entry, distinct from the content */
protected function fetchAtomRelations(string $rel = ""): \DOMNodeList {
// FIXME: The XPath evaluation will fail if the relation contains an apostrophe. This is a known and difficult-to-overcome limitation of XPath 1.0 which I consider not worth the effort to address at this time
if ($rel=="" || $rel=="alternate" || $rel=="http://www.iana.org/assignments/relation/alternate") {
if ($rel=="" || $rel=="alternate" || $rel=="http://www.iana.org/assignments/relation/alternate") {
$cond = "not(@rel) or @rel='' or @rel='alternate' or @rel='http://www.iana.org/assignments/relation/alternate'";
} elseif (strpos($rel, ":")===false) {
} elseif (strpos($rel, ":")===false) {
// FIXME: Checking only for a colon in a link relation is a hack that does not strictly follow IRI rules, but it's adequate for our needs
$cond = "@rel='$rel' or @rel='http://www.iana.org/assignments/relation/$rel'";
use JKingWeb\Lax\Person\Collection as PersonCollection;
use JKingWeb\Lax\Parser\XML\XPath;
trait Entry {
/** Primitive to fetch a collection of authors associated with an Atom entry
*
/** Primitive to fetch a collection of authors associated with an Atom entry
*
* This differs from feeds in that an entry's <source> element (which possibly contains metadata for the source feed) is checked for authors if the entry itself has none
'standard port on schemeless http url' => ['//www.example.com', 80, 80],
];
}
@ -141,13 +130,11 @@ abstract class AbstractUriTestCase extends TestCase
/**
* @group port
*/
public function testUriWithStandardPort()
{
public function testUriWithStandardPort() {
$uri = $this->createUri('http://example.com:80');
$this->assertContains($uri->getPort(), [80, null], "If no port is present, but a scheme is present, this method MAY return the standard port for that scheme, but SHOULD return null.");
}
/**
* @group authority
* @dataProvider authorityProvider
@ -155,8 +142,7 @@ abstract class AbstractUriTestCase extends TestCase
* If the port component is not set or is the standard port for the current
* scheme, it SHOULD NOT be included.
*/
public function testGetAuthority($scheme, $user, $pass, $host, $port, $authority)
{
public function testGetAuthority($scheme, $user, $pass, $host, $port, $authority) {
$uri = $this
->createUri()
->withHost($host)
@ -168,8 +154,7 @@ abstract class AbstractUriTestCase extends TestCase