#68 - refactor some of the notification classes to classes plugin to share them with comments
This commit is contained in:
parent
6ab18b1066
commit
3d4ddc12fc
9 changed files with 22 additions and 105 deletions
36
public/site/plugins/classes/location/Location.php
Normal file
36
public/site/plugins/classes/location/Location.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace adrienpayet\D2P\data\location;
|
||||
|
||||
class Location
|
||||
{
|
||||
protected PageDetails $page;
|
||||
protected ?string $dialogUri = null;
|
||||
protected ProjectDetails $project;
|
||||
protected ?FileDetails $file = null;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->page = new PageDetails($data["page"]);
|
||||
$this->dialogUri = $data["dialogUri"];
|
||||
$this->project = new ProjectDetails($data["project"]);
|
||||
|
||||
if (isset($data['file'])) {
|
||||
$this->file = new FileDetails($data["file"]);
|
||||
}
|
||||
}
|
||||
|
||||
public function toArray() {
|
||||
$array = [
|
||||
"page" => $this->page->toArray(),
|
||||
"project" => $this->project->toArray(),
|
||||
];
|
||||
|
||||
if ($this->dialogUri) {
|
||||
$array["dialogUri"] = $this->dialogUri;
|
||||
$array["file"] = $this->file;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue