mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-11 10:22:40 +00:00
Cleanup
This commit is contained in:
parent
bbace7a0ac
commit
b5f118e8cb
61 changed files with 721 additions and 721 deletions
|
@ -932,7 +932,7 @@ class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the time at which any of a user's subscriptions (or a specific subscription) was last refreshed, as a DateTimeImmutable object */
|
/** Returns the time at which any of a user's subscriptions (or a specific subscription) was last refreshed, as a DateTimeImmutable object */
|
||||||
public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeInterface {
|
public function subscriptionRefreshed(string $user, int $id = null): ?\DateTimeImmutable {
|
||||||
if (!Arsse::$user->authorize($user, __FUNCTION__)) {
|
if (!Arsse::$user->authorize($user, __FUNCTION__)) {
|
||||||
throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]);
|
throw new User\ExceptionAuthz("notAuthorized", ["action" => __FUNCTION__, "user" => $user]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ class Feed {
|
||||||
return $offset;
|
return $offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function computeLastModified(): ?\DateTimeInterface {
|
protected function computeLastModified(): ?\DateTimeImmutable {
|
||||||
if (!$this->modified) {
|
if (!$this->modified) {
|
||||||
return $this->lastModified; // @codeCoverageIgnore
|
return $this->lastModified; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,19 +21,19 @@ class Date {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function normalize($date, string $inFormat = null): ?\DateTimeInterface {
|
public static function normalize($date, string $inFormat = null): ?\DateTimeImmutable {
|
||||||
return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat);
|
return ValueInfo::normalize($date, ValueInfo::T_DATE, $inFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($interval, $date = "now"): ?\DateTimeInterface {
|
public static function add($interval, $date = "now"): ?\DateTimeImmutable {
|
||||||
return self::modify("add", $interval, $date);
|
return self::modify("add", $interval, $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sub($interval, $date = "now"): ?\DateTimeInterface {
|
public static function sub($interval, $date = "now"): ?\DateTimeImmutable {
|
||||||
return self::modify("sub", $interval, $date);
|
return self::modify("sub", $interval, $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function modify(string $func, $interval, $date): ?\DateTimeInterface {
|
protected static function modify(string $func, $interval, $date): ?\DateTimeImmutable {
|
||||||
$date = self::normalize($date);
|
$date = self::normalize($date);
|
||||||
$interval = (!$interval instanceof \DateInterval) ? ValueInfo::normalize($interval, ValueInfo::T_INTERVAL) : $interval;
|
$interval = (!$interval instanceof \DateInterval) ? ValueInfo::normalize($interval, ValueInfo::T_INTERVAL) : $interval;
|
||||||
return $date ? $date->$func($interval) : null;
|
return $date ? $date->$func($interval) : null;
|
||||||
|
|
Loading…
Reference in a new issue