From 9cdfe0ecb4586a72f41611dba03a961839e4a923 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 28 Nov 2019 11:24:05 +0100 Subject: [PATCH] Internal: PHPDoc and warning suppression --- application/itopwebpage.class.inc.php | 178 ++++++++++++++++++-------- application/webpage.class.inc.php | 4 +- 2 files changed, 128 insertions(+), 54 deletions(-) diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 35b8db10f9..8ab3c516cc 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -1,27 +1,20 @@ - - /** - * Class iTopWebPage + * Copyright (C) 2013-2019 Combodo SARL * - * @copyright Copyright (C) 2010-2018 Combodo SARL - * @license http://opensource.org/licenses/AGPL-3.0 + * This file is part of iTop. + * + * iTop is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * iTop is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License */ require_once(APPROOT."/application/nicewebpage.class.inc.php"); @@ -46,6 +39,14 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage protected $sBreadCrumbEntryIcon; protected $oCtx; + /** + * iTopWebPage constructor. + * + * @param string $sTitle + * @param bool $bPrintable + * + * @throws \Exception + */ public function __construct($sTitle, $bPrintable = false) { parent::__construct($sTitle, $bPrintable); @@ -150,6 +151,9 @@ EOF } } + /** + * @return bool + */ protected function IsMenuPaneVisible() { $bLeftPaneOpen = true; @@ -172,6 +176,9 @@ EOF return $bLeftPaneOpen; } + /** + * + */ protected function PrepareLayout() { if (MetaModel::GetConfig()->Get('demo_mode')) @@ -736,11 +743,22 @@ JS $this->sBreadCrumbEntryIcon = null; } + /** + * @param string $sHtml + */ public function AddToMenu($sHtml) { $this->m_sMenu .= $sHtml; } + /** + * @return string + * @throws \CoreException + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @throws \OQLException + */ public function GetSiloSelectionForm() { // List of visible Organizations @@ -801,6 +819,9 @@ JS return $sHtml; } + /** + * @throws \DictExceptionMissingString + */ public function DisplayMenu() { // Display the menu @@ -839,43 +860,43 @@ JS 'ttl' => $oProvider->GetTTL(), ); } - } - if (count($aProviderParams) > 0) - { - $sImageUrl= '../images/newsroom_menu.png'; - $sPlaceholderImageUrl= '../images/newsroom-message.svg'; - $aParams = array( - 'image_url' => $sImageUrl, - 'placeholder_image_url' => $sPlaceholderImageUrl, - 'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT), - 'providers' => $aProviderParams, - 'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7), - 'labels' => array( - 'no_message' => Dict::S('UI:Newsroom:NoNewMessage'), - 'mark_all_as_read' => Dict::S('UI:Newsroom:MarkAllAsRead'), - 'view_all' => Dict::S('UI:Newsroom:ViewAllMessages'), - ), - ); - $sParams = json_encode($aParams); - $this->add_ready_script( -<< 0) + { + $sImageUrl= '../images/newsroom_menu.png'; + $sPlaceholderImageUrl= '../images/newsroom-message.svg'; + $aParams = array( + 'image_url' => $sImageUrl, + 'placeholder_image_url' => $sPlaceholderImageUrl, + 'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT), + 'providers' => $aProviderParams, + 'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7), + 'labels' => array( + 'no_message' => Dict::S('UI:Newsroom:NoNewMessage'), + 'mark_all_as_read' => Dict::S('UI:Newsroom:MarkAllAsRead'), + 'view_all' => Dict::S('UI:Newsroom:ViewAllMessages'), + ), + ); + $sParams = json_encode($aParams); + $this->add_ready_script( + <<add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix)); } + /** + * @param string $sTabContainer + * @param string $sTabLabel + * @param string $sHtml + * + * @return mixed|void + * @throws \Exception + */ public function AddToTab($sTabContainer, $sTabLabel, $sHtml) { $this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml)); } + /** + * @param string $sTabContainer + * + * @return mixed|string + */ public function SetCurrentTabContainer($sTabContainer = '') { return $this->m_oTabs->SetCurrentTabContainer($sTabContainer); } + /** + * @param string $sTabLabel + * + * @return mixed|string + */ public function SetCurrentTab($sTabLabel = '') { return $this->m_oTabs->SetCurrentTab($sTabLabel); @@ -1481,11 +1527,20 @@ EOF; $this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache)); } + /** + * @return string + */ public function GetCurrentTab() { return $this->m_oTabs->GetCurrentTab(); } + /** + * @param string $sTabLabel + * @param string|null $sTabContainer + * + * @return mixed|void + */ public function RemoveTab($sTabLabel, $sTabContainer = null) { $this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer); @@ -1494,6 +1549,9 @@ EOF; /** * Finds the tab whose title matches a given pattern * + * @param string $sPattern + * @param string|null $sTabContainer + * * @return mixed The name of the tab as a string or false if not found */ public function FindTab($sPattern, $sTabContainer = null) @@ -1506,12 +1564,21 @@ EOF; * DOES NOT WORK: apparently in the *old* version of jquery * that we are using this is not supported... TO DO upgrade * the whole jquery bundle... + * + * @param string $sTabContainer + * @param string $sTabLabel */ public function SelectTab($sTabContainer, $sTabLabel) { $this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel)); } + /** + * @param string $sHtml + * + * @return mixed|void + * @throws \Exception + */ public function add($sHtml) { if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != '')) @@ -1577,6 +1644,8 @@ EOF; /** * Set the message to be displayed in the 'app-banner' section at the top of the page + * + * @param string $sHtmlMessage */ public function SetMessage($sHtmlMessage) { @@ -1586,6 +1655,10 @@ EOF; /** * Add message to be displayed in the 'app-banner' section at the top of the page + * + * @param string $sHtmlMessage + * @param string|null $sHtmlIcon + * @param string|null $sTip */ public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null) { @@ -1606,6 +1679,7 @@ EOF; * @param string $sContent * @param string $sCssClasses CSS classes to add to the container * + * @throws \Exception * @since 2.6 */ public function AddHeaderMessage($sContent, $sCssClasses = 'message_info') @@ -1619,6 +1693,8 @@ EOF /** * Adds a script to be executed when the DOM is ready (typical JQuery use), right before add_ready_script * + * @param string $sScript + * * @return void */ public function add_init_script($sScript) diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php index cf227f59b8..a2730b227c 100644 --- a/application/webpage.class.inc.php +++ b/application/webpage.class.inc.php @@ -1198,11 +1198,9 @@ class TabManager } /** - * @param string $sHtml - * * @return int */ - public function GetCurrentTabLength($sHtml) + public function GetCurrentTabLength() { $iLength = isset($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) ? strlen($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) : 0;