DashboardEntry: Introduce counteEntries() method & add return type dec where applicable

This commit is contained in:
Yonas Habteab 2022-06-13 09:11:41 +02:00
parent d0d33d990c
commit 4a347362e2

View File

@ -4,6 +4,9 @@
namespace Icinga\Web\Dashboard\Common; namespace Icinga\Web\Dashboard\Common;
use Icinga\Web\Dashboard\DashboardHome;
use Icinga\Web\Dashboard\Dashlet;
use Icinga\Web\Dashboard\Pane;
use ipl\Web\Url; use ipl\Web\Url;
/** /**
@ -12,18 +15,25 @@ use ipl\Web\Url;
interface DashboardEntry interface DashboardEntry
{ {
/** /**
* Check whether this widget doesn't contain any dashboard entries * Check whether this widget contains any dashboard entries
* *
* @return bool * @return bool
*/ */
public function hasEntries(); public function hasEntries(): bool;
/**
* Get size of the dashboard entries assigned to this widget
*
* @return int
*/
public function countEntries(): int;
/** /**
* Get a dashboard entry by the given name if exists * Get a dashboard entry by the given name if exists
* *
* @param string $name * @param string $name
* *
* @return BaseDashboard * @return DashboardHome|Pane|Dashlet
*/ */
public function getEntry(string $name); public function getEntry(string $name);
@ -34,14 +44,14 @@ interface DashboardEntry
* *
* @return bool * @return bool
*/ */
public function hasEntry(string $name); public function hasEntry(string $name): bool;
/** /**
* Get all dashboard entries of this widget * Get all dashboard entries of this widget
* *
* @return BaseDashboard[] * @return BaseDashboard[]
*/ */
public function getEntries(); public function getEntries(): array;
/** /**
* Set dashboard entries of this widget * Set dashboard entries of this widget
@ -76,7 +86,7 @@ interface DashboardEntry
* *
* @return string[] * @return string[]
*/ */
public function getEntryKeyTitleArr(); public function getEntryKeyTitleArr(): array;
/** /**
* Remove the given entry from this widget * Remove the given entry from this widget