Mark data classes and functions with types
This commit is contained in:
@@ -5,51 +5,58 @@ declare(strict_types=1);
|
||||
namespace pvv\side;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
|
||||
abstract class Event {
|
||||
private $start;
|
||||
private DateTimeImmutable $start;
|
||||
|
||||
public function __construct(\DateTimeImmutable $start) {
|
||||
public function __construct(DateTimeImmutable $start) {
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
public function getStart() {
|
||||
public function getStart(): DateTimeImmutable {
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
public function getRelativeDate() {
|
||||
public function getRelativeDate(): string {
|
||||
if (Agenda::isToday($this->getStart())) {
|
||||
return 'i dag';
|
||||
return "i dag";
|
||||
}
|
||||
if (Agenda::isTomorrow($this->getStart())) {
|
||||
return 'i morgen';
|
||||
return "i morgen";
|
||||
}
|
||||
if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new \DateInterval('P4D'))->getTimestamp() < time()) {
|
||||
return $this->getStart()->format('l');
|
||||
if (
|
||||
Agenda::isThisWeek($this->getStart()) ||
|
||||
$this->getStart()->sub(new DateInterval("P4D"))->getTimestamp() < time()
|
||||
) {
|
||||
return $this->getStart()->format("l");
|
||||
}
|
||||
if (Agenda::isNextWeek($this->getStart())) {
|
||||
return 'neste uke';
|
||||
return "neste uke";
|
||||
}
|
||||
if (Agenda::isThisMonth($this->getStart())) {
|
||||
return 'denne måneden';
|
||||
return "denne måneden";
|
||||
}
|
||||
|
||||
return $this->getStart()->format('j. F');
|
||||
return $this->getStart()->format("j. F");
|
||||
}
|
||||
|
||||
abstract public function getStop(); /* : DateTimeImmutable */
|
||||
abstract public function getStop(): DateTimeImmutable;
|
||||
|
||||
abstract public function getName();
|
||||
abstract public function getName(): string;
|
||||
|
||||
abstract public function getLocation();
|
||||
abstract public function getLocation(): string;
|
||||
|
||||
abstract public function getOrganiser();
|
||||
abstract public function getOrganiser(): string;
|
||||
|
||||
abstract public function getURL(); /* : string */
|
||||
abstract public function getURL(): string;
|
||||
|
||||
abstract public function getImageURL(); /* : string */
|
||||
abstract public function getImageURL(): string;
|
||||
|
||||
abstract public function getDescription(); /* : string */
|
||||
/*
|
||||
* @return string[]
|
||||
*/
|
||||
abstract public function getDescription(): array;
|
||||
|
||||
abstract public function getColor(); /* : string */
|
||||
abstract public function getColor(): string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user