Fix API result, add PHPDoc and cleanup object construction
Fix missing getters fix data array fix missing "$" for template-variables Remove lazy-loaded parent notification instance (for now..)
This commit is contained in:
parent
4c5856da2b
commit
74f3a2f90c
7 changed files with 203 additions and 218 deletions
|
@ -94,18 +94,16 @@ class Notification implements \JsonSerializable
|
|||
return $this->seen;
|
||||
}
|
||||
|
||||
public function __construct(string $label = '', string $link = '', string $image = '',
|
||||
string $url = '', string $text = '',
|
||||
string $when = '', string $ago = '', bool $seen = false)
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->label = $label;
|
||||
$this->link = $link;
|
||||
$this->image = $image;
|
||||
$this->url = $url;
|
||||
$this->text = $text;
|
||||
$this->when = $when;
|
||||
$this->ago = $ago;
|
||||
$this->seen = $seen;
|
||||
$this->label = $data['label'] ?? '';
|
||||
$this->link = $data['link'] ?? '';
|
||||
$this->image = $data['image'] ?? '';
|
||||
$this->url = $data['url'] ?? '';
|
||||
$this->text = $data['text'] ?? '';
|
||||
$this->when = $data['when'] ?? '';
|
||||
$this->ago = $data['ago'] ?? '';
|
||||
$this->seen = $data['seen'] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue