From 9ea0c863dd644668250de4650608dc59bb2bb0dd Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Sat, 3 Jun 2017 11:39:59 +0200 Subject: [PATCH] TASK: PSR-2 and copyright notice --- .../Menu/MenuService/ServiceInterface.php | 25 +++++--- .../Menu/MenuService/SettingsService.php | 63 +++++++++++-------- Classes/DigiComp/Menu/Package.php | 39 ++++++++---- .../Menu/ViewHelpers/MenuViewHelper.php | 52 ++++++++------- 4 files changed, 109 insertions(+), 70 deletions(-) diff --git a/Classes/DigiComp/Menu/MenuService/ServiceInterface.php b/Classes/DigiComp/Menu/MenuService/ServiceInterface.php index 6873d98..93a1b04 100644 --- a/Classes/DigiComp/Menu/MenuService/ServiceInterface.php +++ b/Classes/DigiComp/Menu/MenuService/ServiceInterface.php @@ -1,15 +1,26 @@ configurationManager = $configurationManager; - $this->menu = $this->configurationManager->getConfiguration('Menu'); + $this->menuConfiguration = $this->configurationManager->getConfiguration('Menu'); } /** * @var array */ - protected $menu; + protected $menuConfiguration; + /** + * @var array + */ protected $items = array(); - /** - * @param string $forMenu - * @return array - */ - public function getItems($forMenu = NULL) { - if ($forMenu){ - $items = &$this->menu[$forMenu]; - }else { - $items = &$this->menu; - } - if ($items) { - uasort($items, function ($a, $b) { - return $a['sorting'] > $b['sorting']; - }); - } + /** + * @param string $forMenu + * @return array + */ + public function getItems($forMenu = null) + { + if ($forMenu) { + $items = &$this->menuConfiguration[$forMenu]; + }else { + $items = &$this->menuConfiguration; + } + if ($items) { + uasort( + $items, function ($a, $b) { + return $a['sorting'] > $b['sorting']; + } + ); + } return $items; } - - } \ No newline at end of file diff --git a/Classes/DigiComp/Menu/Package.php b/Classes/DigiComp/Menu/Package.php index a252707..897edaf 100644 --- a/Classes/DigiComp/Menu/Package.php +++ b/Classes/DigiComp/Menu/Package.php @@ -1,25 +1,38 @@ getSignalSlotDispatcher(); - $dispatcher->connect('TYPO3\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', - function(ConfigurationManager $configurationManager){ - $configurationManager->registerConfigurationType('Menu'); - }); + $dispatcher->connect( + 'TYPO3\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', + function (ConfigurationManager $configurationManager) { + $configurationManager->registerConfigurationType('Menu'); + } + ); } - -} \ No newline at end of file +} \ No newline at end of file diff --git a/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php b/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php index 7bb0a0d..a2d7305 100644 --- a/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php +++ b/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php @@ -1,22 +1,27 @@ templateVariableContainer->add($as, $this->menuService->getItems($forPath)); return $this->renderChildren(); } } - -?> \ No newline at end of file