From ccfb432e4d3dc95b53b39183193847535234af7d Mon Sep 17 00:00:00 2001 From: Vassyli Date: Thu, 12 Apr 2018 19:49:10 +0200 Subject: [PATCH] ActionGroup now implements Countable interface. --- src/ActionGroup.php | 11 ++++++++++- src/Game.php | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ActionGroup.php b/src/ActionGroup.php index 37fea40..5388298 100644 --- a/src/ActionGroup.php +++ b/src/ActionGroup.php @@ -6,7 +6,7 @@ /** * A grouping of navigation actions, like a submenu. */ -class ActionGroup +class ActionGroup implements \Countable { const DefaultGroup = 'lotgd/core/default'; const HiddenGroup = 'lotgd/core/hidden'; @@ -30,6 +30,15 @@ public function __construct(string $id, string $title, int $sortKey) $this->actions = []; } + /** + * Returns the number of registered Actions for this group. + * @return int + */ + public function count(): int + { + return count($this->actions); + } + /** * Returns the unique identifier for this group, in the vendor/module/group format. * @return string diff --git a/src/Game.php b/src/Game.php index 8d00e75..aac4a2d 100644 --- a/src/Game.php +++ b/src/Game.php @@ -4,6 +4,7 @@ namespace LotGD\Core; use DateTime; +use Doctrine\Common\Util\Debug; use Doctrine\ORM\EntityManagerInterface; use LotGD\Core\Events\NavigateToSceneData; use LotGD\Core\Events\NewViewpointData;