name)) {
$this->name = $data->name;
}
if(!empty($data->version)) {
$this->version = $data->version;
}
// @ToDo check Enum
if(!empty($data->category)) {
$this->category = $data->category;
}
if(!empty($data->icon)) {
$this->icon = $data->icon;
}
if(!empty($data->order)) {
$this->order = $data->order;
}
if(!empty($data->description)) {
$this->description = $data->description;
}
if(!empty($data->author)) {
$this->author = new ModuleAuthor($data->author);
}
if(!empty($data->repository)) {
$this->repository = $data->repository;
}
if(!empty($data->depencies)) {
$this->depencies = $data->depencies;
}
$this->is_valid = true;
}
public function isValid() : bool {
return $this->is_valid;
}
public function getName() : ?string {
return $this->name;
}
public function getVersion() : ?string {
return $this->version;
}
public function getCategory() : ?string {
return $this->category;
}
public function getOrder() : int {
return $this->order;
}
public function getIcon(bool $raw = false) : ?string {
if($raw) {
return $this->icon;
}
/* When the Icon is an URL or an embedded Image (Base64) */
if(preg_match('/^(http|https|data):/', $this->icon)) {
return sprintf('
', $this->icon);
}
// @ToDo check if its an local file
return sprintf('', $this->icon);
}
public function getDescription() : string {
return $this->description;
}
public function getAuthor() : ?ModuleAuthor {
return $this->author;
}
public function getRepository() : ?string {
return $this->repository;
}
public function getDepencies() : object {
if($this->depencies === null) {
return (object) [];
}
return $this->depencies;
}
}
?>