Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 82b00437 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: missing return types, qualifier imports, code cleanup

Übergeordneter 77803539
No related branches found
No related tags found
3 Merge Requests!25feat!: quiqqer v2,!24feat!: quiqqer v2,!23feat!: quiqqer v2
......@@ -18,7 +18,7 @@
/**
* Class DropDownMenu
* Creates an Drop Down Menu
* Creates a Drop-Down Menu
*
* @package QUI\Menu
* @author www.pcsg.de (Henning Leutz)
......
......@@ -2,6 +2,7 @@
namespace QUI\Menu\Independent;
use Exception;
use QUI;
/**
......@@ -29,7 +30,7 @@ public static function createMenu(): Menu
try {
QUI::getEvents()->fireEvent('quiqqerMenuIndependentCreate', [$Menu]);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
......@@ -42,7 +43,7 @@ public static function createMenu(): Menu
* @throws QUI\Database\Exception
* @throws QUI\Permissions\Exception
*/
public static function deleteMenu(int $menuId)
public static function deleteMenu(int $menuId): void
{
QUI\Permissions\Permission::checkPermission('quiqqer.menu.delete');
......@@ -52,7 +53,7 @@ public static function deleteMenu(int $menuId)
try {
QUI::getEvents()->fireEvent('quiqqerMenuIndependentDelete', [$menuId]);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
}
......
......@@ -36,7 +36,7 @@ public static function getMenu(int $menuId): Menu
* @param QUI\Projects\Project|null $Project
* @return string
*/
public static function getMenuCacheName($menuId = false, QUI\Projects\Project $Project = null): string
public static function getMenuCacheName(bool|int $menuId = false, QUI\Projects\Project $Project = null): string
{
if ($Project) {
$project = $Project->getName();
......
......@@ -82,7 +82,7 @@ public function getName(Locale $Locale = null): string
/**
* alias for name
* - can be use for the `a title=""` attribute
* - can be used for the `a title=""` attribute
*
* @param Locale|null $Locale
* @return string
......@@ -179,7 +179,7 @@ public function getMenuType(): string
/**
* @return mixed
*/
public function getCustomData()
public function getCustomData(): mixed
{
if (isset($this->attributes['data'])) {
return $this->attributes['data'];
......@@ -322,7 +322,7 @@ public function getChildren(bool $onlyActive = true): array
*
* @param AbstractMenuItem $Item
*/
public function appendChild(AbstractMenuItem $Item)
public function appendChild(AbstractMenuItem $Item): void
{
$this->children[] = $Item;
}
......
......@@ -35,7 +35,7 @@ public function getUrl(): string
if ($Site) {
try {
$url .= $Site->getUrlRewritten();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
}
......@@ -66,7 +66,7 @@ public function getSite(): ?QUI\Projects\Site
try {
$siteUrl = $data['site'];
$Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
return null;
}
......@@ -79,7 +79,7 @@ public function getSite(): ?QUI\Projects\Site
$langId = $Site->getId($current);
$LangProject = QUI::getProject($Project->getName(), $current);
return $LangProject->get($langId);
} catch (QUI\Exception $exception) {
} catch (QUI\Exception) {
return null;
}
}
......
......@@ -58,7 +58,7 @@ public function getSite(): ?QUI\Projects\Site
try {
$siteUrl = $data['site'];
$Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
return null;
}
......@@ -72,7 +72,7 @@ public function getSite(): ?QUI\Projects\Site
$LangProject = QUI::getProject($Project->getName(), $current);
return $LangProject->get($langId);
} catch (QUI\Exception $exception) {
} catch (QUI\Exception) {
return null;
}
}
......@@ -136,7 +136,7 @@ public function getTitle(QUI\Locale $Locale = null): string
$Site = QUI\Projects\Site\Utils::getSiteByLink($siteUrl);
return $Site->getAttribute('title');
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
return '';
......@@ -152,7 +152,7 @@ public function getUrl(): string
if ($Site) {
try {
return $Site->getUrlRewritten();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
return '';
}
}
......
......@@ -2,6 +2,7 @@
namespace QUI\Menu\Independent;
use Exception;
use QUI;
use QUI\Menu\Independent\Items\AbstractMenuItem;
......@@ -33,7 +34,7 @@ class Menu
* @throws QUI\Exception
* @throws QUI\Database\Exception
*/
public function __construct($menuId)
public function __construct(int|array $menuId)
{
if (is_numeric($menuId)) {
$data = Handler::getMenuData($menuId);
......@@ -92,7 +93,7 @@ public function __construct($menuId)
* @param array $children
* @return void
*/
protected function buildChildren($Parent, array $children)
protected function buildChildren(AbstractMenuItem|Menu $Parent, array $children): void
{
foreach ($children as $item) {
$type = $item['type'];
......@@ -124,7 +125,7 @@ protected function buildChildren($Parent, array $children)
*
* @param AbstractMenuItem $Item
*/
public function appendChild(AbstractMenuItem $Item)
public function appendChild(AbstractMenuItem $Item): void
{
$this->children[] = $Item;
}
......@@ -244,7 +245,7 @@ public function getData(): array
* @throws QUI\Database\Exception
* @throws QUI\Permissions\Exception
*/
public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
public function save(?QUI\Interfaces\Users\User $PermissionUser = null): void
{
QUI\Permissions\Permission::checkPermission('quiqqer.menu.edit', $PermissionUser);
......@@ -258,7 +259,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
try {
QUI::getEvents()->fireEvent('quiqqerMenuIndependentSave', [$this]);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
}
......@@ -269,7 +270,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
* @param array|null $title - ['de' => '', 'en' => '']
* @return void
*/
public function setTitle(?array $title)
public function setTitle(?array $title): void
{
if ($title === null) {
return;
......@@ -294,7 +295,7 @@ public function setTitle(?array $title)
* @param array|null $title - ['de' => '', 'en' => '']
* @return void
*/
public function setWorkingTitle(?array $title)
public function setWorkingTitle(?array $title): void
{
if ($title === null) {
return;
......@@ -317,7 +318,7 @@ public function setWorkingTitle(?array $title)
* @param array|null $data
* @return void
*/
public function setData(?array $data)
public function setData(?array $data): void
{
if ($data === null) {
return;
......
......@@ -53,7 +53,7 @@ public function getChildren(): ?array
* @return int
* @throws Exception
*/
public function count()
public function count(): int
{
return count($this->getChildren());
}
......
......@@ -144,7 +144,7 @@ public function getBody(): string
}
return $cacheResult['html'];
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -20,7 +20,7 @@ class SlideOut extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'showHomeLink' => true,
......@@ -77,9 +77,9 @@ public function getBody(): string
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -8,9 +8,11 @@
use QUI;
use function dirname;
/**
* Class MenuAdvanced
* Creates an slideout menu
* Creates a slide-out menu
*
* @package QUI\Menu
*/
......@@ -19,7 +21,7 @@ class SlideOutAdvanced extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'menuId' => false, // if set independent menu template will be used
......@@ -31,7 +33,7 @@ public function __construct($attributes = [])
parent::__construct($attributes);
$this->addCSSFile(
\dirname(__FILE__) . '/SlideOutAdvanced.css'
dirname(__FILE__) . '/SlideOutAdvanced.css'
);
}
......@@ -73,9 +75,9 @@ public function getBody(): string
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -30,7 +30,7 @@ class UrlList extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// defaults values
$this->setAttributes([
......@@ -106,7 +106,7 @@ public function getBody(): string
* @return array
* @throws QUI\Exception
*/
public function getChildrenForIndependentMenu()
public function getChildrenForIndependentMenu(): array
{
$IndependentMenu = Independent\Handler::getMenu($this->getAttribute('menuId'));
......@@ -116,10 +116,10 @@ public function getChildrenForIndependentMenu()
/**
* Get sites for QUI site
*
* @return array
* @throws QUI\Exception
* @return array|int
* @throws Exception
*/
public function getChildrenForQUISite()
public function getChildrenForQUISite(): array|int
{
$Project = $this->getProject();
......@@ -146,7 +146,7 @@ public function getChildrenForQUISite()
* @return array|int
* @throws QUI\Exception
*/
public function getChildren(QUI\Projects\Site $Site)
public function getChildren(QUI\Projects\Site $Site): array|int
{
if (!$this->getAttribute('showAllChildren')) {
return $Site->getNavigation();
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren