All checks were successful
Push image to registry / build-image (push) Successful in 5m20s
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Notification;
|
|
|
|
use App\Models\Job;
|
|
use App\Notification\Stringifiable\StringifiableSimpleText;
|
|
use function PHPUnit\Framework\isNull;
|
|
|
|
abstract class Notification {
|
|
|
|
protected Job $job;
|
|
private NotificationBody $body;
|
|
|
|
public bool $isError;
|
|
|
|
public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) {
|
|
$this->job = Job::find($jobId);
|
|
if (!isNull($body)) {
|
|
$this->body = $body;
|
|
}
|
|
$this->isError = $isError;
|
|
}
|
|
|
|
public function setBody(NotificationBody $body) {
|
|
$this->body = $body;
|
|
}
|
|
|
|
public function getTitle(): Stringifiable {
|
|
return new StringifiableSimpleText($this->job->name);
|
|
}
|
|
|
|
public function getBody(): Stringifiable {
|
|
return $this->body;
|
|
}
|
|
|
|
abstract public function getLinkURL(): ?string;
|
|
|
|
public function getImageURL(): ?string {
|
|
$imageProjectPath = $this->getImageProjectPath();
|
|
if ($imageProjectPath === null) {
|
|
return null;
|
|
}
|
|
return url($imageProjectPath);
|
|
}
|
|
|
|
abstract public function getImageProjectPath(): ?string;
|
|
}
|