1
0
Fork 0

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:
Philipp Holzer 2020-01-25 20:00:58 +01:00
commit 74f3a2f90c
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
7 changed files with 203 additions and 218 deletions

View file

@ -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;
}
/**