Browse Source

Whitespace fixes

master
J. King 4 years ago
parent
commit
fea772fa83
  1. 2
      lib/Parser/Construct.php
  2. 4
      lib/Parser/XML/Construct.php
  3. 6
      lib/Parser/XML/Feed.php

2
lib/Parser/Construct.php

@ -98,7 +98,7 @@ trait Construct {
}
protected function empty($o, array $ignore = []): bool {
return !array_filter((array) $o, function($v, $k) use($ignore) {
return !array_filter((array) $o, function($v, $k) use ($ignore) {
return !in_array($k, $ignore) && !is_null($v) && (!$v instanceof Collection || sizeof($v) > 0);
}, \ARRAY_FILTER_USE_BOTH);
}

4
lib/Parser/XML/Construct.php

@ -54,7 +54,7 @@ abstract class Construct {
* @param bool|null $multi Whether to return multiple results as an array (true) or one result as a string (false, default)
* @param \DOMNode $context The context node for the XPath query
* @return string|array|null
*/
*/
protected function fetchString(string $query, ?string $pattern = null, ?bool $multi = null, ?\DOMNode $context = null) {
$out = [];
$pattern = strlen($pattern ?? "") ? "/^(?:".str_replace("/", "\\/", $pattern).")$/i" : "";
@ -86,7 +86,7 @@ abstract class Construct {
$out = [];
$tz = new \DateTimeZone("UTC");
assert(in_array($mode, [self::DATE_ANY, self::DATE_ALL, self::DATE_EARLIEST, self::DATE_LATEST]));
foreach((array) $this->fetchString($query, null, true, $context) as $d) {
foreach ((array) $this->fetchString($query, null, true, $context) as $d) {
if ($d = $this->parseDate($d ?? "")) {
if ($mode === self::DATE_ANY) {
return $d;

6
lib/Parser/XML/Feed.php

@ -108,7 +108,7 @@ class Feed extends Construct implements \MensBeam\Lax\Parser\Feed {
public function getSchedule(): Schedule {
$sched = new Schedule;
$sched->interval = $this->getSchedIntervalRss1() ?? $this->getSchedIntervalRss2();
$sched->interval = $this->getSchedIntervalRss1() ?? $this->getSchedIntervalRss2();
$sched->skip = $this->getSchedSkipRss2();
$sched->expired = $this->getExpiredPod();
if (is_null($sched->expired) && (($sched->skip & Schedule::DAY_ALL) == Schedule::DAY_ALL || ($sched->skip & Schedule::HOUR_ALL) == Schedule::HOUR_ALL)) {
@ -277,7 +277,7 @@ class Feed extends Construct implements \MensBeam\Lax\Parser\Feed {
/** Computes the "skip-schedule" of an RSS feed, the set of days and hours during which a feed should not be fetched */
protected function getSchedSkipRss2(): ?int {
$out = 0;
foreach($this->fetchString("rss2:skipHours/rss2:hour", "\d+", true) ?? [] as $h) {
foreach ($this->fetchString("rss2:skipHours/rss2:hour", "\d+", true) ?? [] as $h) {
$out |= [
Schedule::HOUR_0,
Schedule::HOUR_1,
@ -306,7 +306,7 @@ class Feed extends Construct implements \MensBeam\Lax\Parser\Feed {
Schedule::HOUR_0,
][(int) $h] ?? 0;
}
foreach($this->fetchString("rss2:skipDays/rss2:day", null, true) ?? [] as $d) {
foreach ($this->fetchString("rss2:skipDays/rss2:day", null, true) ?? [] as $d) {
$out |= [
"monday" => Schedule::DAY_MON,
"tuesday" => Schedule::DAY_TUE,

Loading…
Cancel
Save