N°7059 - Symfony 6.4 - Add missing namespaces to match PSR-4 convention (#589)

This commit is contained in:
Benjamin Dalsass
2023-12-21 10:18:11 +01:00
committed by GitHub
parent afbdff928d
commit 34f0053db7
151 changed files with 669 additions and 289 deletions

View File

@@ -17,33 +17,16 @@
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\WebPage;
use Combodo\iTop\Application\Branding;
use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
use Combodo\iTop\Renderer\BlockRenderer;
use Combodo\iTop\Renderer\Console\ConsoleBlockRenderer;
$sPortalBaseFolderRelPath = 'env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/';
$sPortalSourcesFolderRelPath = $sPortalBaseFolderRelPath . 'src/';
$sPortalPublicFolderRelPath = $sPortalBaseFolderRelPath . 'public/';
$sPortalBaseFolderAbsPath = APPROOT . $sPortalBaseFolderRelPath;
$sPortalSourcesFolderAbsPath = APPROOT . $sPortalSourcesFolderRelPath;
$sPortalPublicFolderAbsPath = APPROOT . $sPortalPublicFolderRelPath;
/** @noinspection PhpUnhandledExceptionInspection */
$sPortalPublicFolderAbsUrl = utils::GetAbsoluteUrlModulesRoot().'/itop-portal-base/portal/public/';
// Constants to be used in the UnauthenticatedWebPage
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL'))
{
define('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL', $sPortalPublicFolderAbsUrl);
}
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH'))
{
define('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH', $sPortalPublicFolderRelPath);
}
use Dict;
use Exception;
use ExecutionKPI;
use utils;
/**
* Class UnauthenticatedWebPage
@@ -62,12 +45,29 @@ class UnauthenticatedWebPage extends NiceWebPage
// TODO 3.0 Find a clever way to allow theme customization for unauthenticated webpages
private $sCustomThemeUrl;
/** @since 3.2.0 */
protected string $sPortalBaseFolderRelPath;
/** @since 3.2.0 */
protected string $sPortalSourcesFolderRelPath;
/** @since 3.2.0 */
protected string $sPortalPublicFolderRelPath;
/** @since 3.2.0 */
protected string $sPortalBaseFolderAbsPath;
/** @since 3.2.0 */
protected string $sPortalSourcesFolderAbsPath;
/** @since 3.2.0 */
protected string $sPortalPublicFolderAbsPath;
/** @since 3.2.0 */
protected string $sPortalPublicFolderAbsUrl;
/**
* @inheritDoc
* @throws \Exception
*/
public function __construct($s_title, $bPrintable = false)
{
$this->Init();
$oKpi = new ExecutionKPI();
parent::__construct($s_title, $bPrintable);
@@ -75,8 +75,7 @@ class UnauthenticatedWebPage extends NiceWebPage
$this->sPanelTitle = '';
$this->sPanelIcon = Branding::GetLoginLogoAbsoluteUrl();
$this->SetContentType('text/html');
// - bootstrap
$this->add_linked_script(UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL . 'lib/bootstrap/js/bootstrap.min.js');
@@ -96,6 +95,36 @@ class UnauthenticatedWebPage extends NiceWebPage
$oKpi->ComputeStats(get_class($this).' creation', $s_title);
}
/**
* Init.
*
* @return void
* @throws \Exception
*/
private function Init(): void
{
$this->sPortalBaseFolderRelPath = 'env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/';
$this->sPortalSourcesFolderRelPath = $this->sPortalBaseFolderRelPath . 'src/';
$this->sPortalPublicFolderRelPath = $this->sPortalBaseFolderRelPath . 'public/';
$this->sPortalBaseFolderAbsPath = APPROOT . $this->sPortalBaseFolderRelPath;
$this->sPortalSourcesFolderAbsPath = APPROOT . $this->sPortalSourcesFolderRelPath;
$this->sPortalPublicFolderAbsPath = APPROOT . $this->sPortalPublicFolderRelPath;
/** @noinspection PhpUnhandledExceptionInspection */
$this->sPortalPublicFolderAbsUrl = utils::GetAbsoluteUrlModulesRoot().'/itop-portal-base/portal/public/';
// Constants to be used in the UnauthenticatedWebPage
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL'))
{
define('UAWP_PORTAL_PUBLIC_FOLDER_ABSOLUTE_URL', $this->sPortalPublicFolderAbsUrl);
}
if(!defined('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH'))
{
define('UAWP_PORTAL_PUBLIC_FOLDER_RELATIVE_PATH', $this->sPortalPublicFolderRelPath);
}
}
/**
* @inheritdoc
*/
@@ -182,7 +211,7 @@ class UnauthenticatedWebPage extends NiceWebPage
*
* @param string $sMessage
*
* @throws \Exception
* @throws Exception
*/
public function DisplaySuccessMessage($sMessage)
{
@@ -194,7 +223,7 @@ class UnauthenticatedWebPage extends NiceWebPage
*
* @param string $sMessage
*
* @throws \Exception
* @throws Exception
*/
public function DisplayErrorMessage($sMessage)
{
@@ -216,7 +245,7 @@ class UnauthenticatedWebPage extends NiceWebPage
/**
* @param string $sPanelTitle
*
* @return \UnauthenticatedWebPage
* @return UnauthenticatedWebPage
*/
public function SetPanelTitle(string $sPanelTitle): UnauthenticatedWebPage
{
@@ -235,7 +264,7 @@ class UnauthenticatedWebPage extends NiceWebPage
/**
* @param string $sPanelIcon
*
* @return \UnauthenticatedWebPage
* @return UnauthenticatedWebPage
*/
public function SetPanelIcon(string $sPanelIcon): UnauthenticatedWebPage
{