BaseDashboard: Don't implement DashboardEntry interface

This commit is contained in:
Yonas Habteab 2022-06-13 08:58:57 +02:00
parent 7698baf5b8
commit 79ca930930

View File

@ -9,7 +9,7 @@ namespace Icinga\Web\Dashboard\Common;
* *
* All Icinga Web dashboard widgets should extend this class * All Icinga Web dashboard widgets should extend this class
*/ */
abstract class BaseDashboard implements DashboardEntry abstract class BaseDashboard
{ {
/** /**
* Not translatable name of this widget * Not translatable name of this widget
@ -160,7 +160,7 @@ abstract class BaseDashboard implements DashboardEntry
* *
* @return ?string * @return ?string
*/ */
public function getOwner() public function getOwner(): ?string
{ {
return $this->owner; return $this->owner;
} }
@ -170,7 +170,7 @@ abstract class BaseDashboard implements DashboardEntry
* *
* @return ?string * @return ?string
*/ */
public function getDescription() public function getDescription(): ?string
{ {
return $this->description; return $this->description;
} }
@ -224,7 +224,7 @@ abstract class BaseDashboard implements DashboardEntry
{ {
foreach ($data as $name => $value) { foreach ($data as $name => $value) {
$func = 'set' . ucfirst($name); $func = 'set' . ucfirst($name);
if (method_exists($this, $func)) { if ($value && method_exists($this, $func)) {
$this->$func($value); $this->$func($value);
} }
} }
@ -237,68 +237,19 @@ abstract class BaseDashboard implements DashboardEntry
* *
* Stringifies the attrs or set to null if it doesn't have a value, when $stringify is true * Stringifies the attrs or set to null if it doesn't have a value, when $stringify is true
* *
* @param bool $stringify Whether, the attributes should be returned unmodified * @param bool $stringify Whether the attributes should be returned unmodified
* *
* @return array * @return array
*/ */
public function toArray(bool $stringify = true): array public function toArray(bool $stringify = true): array
{ {
return []; return [
} 'id' => $this->getUuid(),
'name' => $this->getName(),
public function hasEntries() 'label' => $this->getTitle(),
{ 'owner' => $this->getOwner(),
} 'priority' => $this->getPriority(),
'description' => $this->getDescription()
public function getEntry(string $name) ];
{
}
public function hasEntry(string $name)
{
}
public function getEntries()
{
}
public function setEntries(array $entries)
{
}
public function addEntry(BaseDashboard $dashboard)
{
}
public function createEntry(string $name, $url = null)
{
}
public function getEntryKeyTitleArr()
{
}
public function removeEntry($entry)
{
}
public function removeEntries(array $entries = [])
{
}
public function manageEntry($entryOrEntries, BaseDashboard $origin = null, bool $manageRecursive = false)
{
}
public function loadDashboardEntries(string $name = null)
{
}
public function rewindEntries()
{
}
public function unsetEntry(BaseDashboard $dashboard)
{
} }
} }