Skip to content

Commit

Permalink
phpstan lvl 4 fixes, not enforced
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Nov 7, 2023
1 parent 9f57faf commit 2ac1dd9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 52 deletions.
10 changes: 4 additions & 6 deletions front/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@
echo "<table class='tab_cadre'>";
echo "<tr><th colspan='2'>" . __('Database Inventory', 'databaseinventory') . "</th></tr>";

if (PluginDatabaseinventoryDatabaseParam::canView()) {
echo "<tr class='tab_bg_1 center'>";
echo "<td><i class='fas fa-cog'></i></td>";
echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginDatabaseinventoryDatabaseParam') . "'>"
. PluginDatabaseinventoryDatabaseParam::getTypeName(2) . "</a></td></tr>";
}
echo "<tr class='tab_bg_1 center'>";
echo "<td><i class='fas fa-cog'></i></td>";
echo "<td><a href='" . Toolbox::getItemTypeSearchURL('PluginDatabaseinventoryDatabaseParam') . "'>"
. PluginDatabaseinventoryDatabaseParam::getTypeName(2) . "</a></td></tr>";

if (PluginDatabaseinventoryCredential::canView()) {
echo "<tr class='tab_bg_1 center'>";
Expand Down
16 changes: 0 additions & 16 deletions inc/contactlog.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private static function showForDatabaseParams(PluginDatabaseinventoryDatabasePar
$rand = mt_rand();

$canread = $databaseparams->can($ID, READ);
$canedit = false;
echo "<div class='spaced'>";
if ($canread) {
echo "<div class='spaced'>";
Expand All @@ -112,13 +111,6 @@ private static function showForDatabaseParams(PluginDatabaseinventoryDatabasePar
$header_bottom = '';
$header_end = '';

if ($canedit) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}

$header_end .= "<th>" . PluginDatabaseinventoryCredential::getTypeName(0) . "</th>";
$header_end .= "<th>" . Agent::getTypeName(0) . "</th>";
$header_end .= "<th>" . __('Date') . "</th>";
Expand Down Expand Up @@ -179,7 +171,6 @@ private static function showForAgent(Agent $agent)
$rand = mt_rand();

$canread = $agent->can($ID, READ);
$canedit = false;
echo "<div class='spaced'>";
if ($canread) {
echo "<div class='spaced'>";
Expand All @@ -189,13 +180,6 @@ private static function showForAgent(Agent $agent)
$header_bottom = '';
$header_end = '';

if ($canedit) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}

$header_end .= "<th>" . PluginDatabaseinventoryCredential::getTypeName(0) . "</th>";
$header_end .= "<th>" . PluginDatabaseinventoryDatabaseParam::getTypeName(0) . "</th>";
$header_end .= "<th>" . __('Date') . "</th>";
Expand Down
12 changes: 0 additions & 12 deletions inc/credentialtype.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,16 @@ public static function getModuleKeyById($credential_type_id)
switch ($credential_type_id) {
case self::MYSQL:
return 'mysql';
break;
case self::ORACLE:
return 'oracle';
break;
case self::DB2:
return 'db2';
break;
case self::MSSQL:
return 'mssql';
break;
case self::POSTGRE_SQL:
return 'postgresql';
break;
case self::MONGO_DB:
return 'mongodb';
break;
}
}

Expand All @@ -116,22 +110,16 @@ public static function getModuleKeyByName($credential_type)
switch ($credential_type) {
case 'mysql':
return self::MYSQL;
break;
case 'oracle':
return self::ORACLE;
break;
case 'db2':
return self::DB2;
break;
case 'mssql':
return self::MSSQL;
break;
case 'postgresql':
return self::POSTGRE_SQL;
break;
case 'mongodb':
return self::MONGO_DB;
break;
}
}

Expand Down
30 changes: 12 additions & 18 deletions inc/menu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ public static function getMenuContent()
'icon' => PluginDatabaseinventoryDatabaseParam::getIcon(),
];

if (true) {
$menu['options']['databaseparam']['links'] = [
'search' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
'add' => PluginDatabaseinventoryDatabaseParam::getFormURL(false),
];
}
$menu['options']['databaseparam']['links'] = [
'search' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
'add' => PluginDatabaseinventoryDatabaseParam::getFormURL(false),
];
}

if (PluginDatabaseinventoryComputerGroup::canView()) {
Expand All @@ -65,12 +63,10 @@ public static function getMenuContent()
'icon' => PluginDatabaseinventoryComputerGroup::getIcon(),
];

if (true) {
$menu['options']['computergroup']['links'] = [
'search' => PluginDatabaseinventoryComputerGroup::getSearchURL(false),
'add' => PluginDatabaseinventoryComputerGroup::getFormURL(false),
];
}
$menu['options']['computergroup']['links'] = [
'search' => PluginDatabaseinventoryComputerGroup::getSearchURL(false),
'add' => PluginDatabaseinventoryComputerGroup::getFormURL(false),
];
}

if (PluginDatabaseinventoryCredential::canView()) {
Expand All @@ -80,12 +76,10 @@ public static function getMenuContent()
'icon' => PluginDatabaseinventoryCredential::getIcon(),
];

if (true) {
$menu['options']['credential']['links'] = [
'search' => PluginDatabaseinventoryCredential::getSearchURL(false),
'add' => PluginDatabaseinventoryCredential::getFormURL(false),
];
}
$menu['options']['credential']['links'] = [
'search' => PluginDatabaseinventoryCredential::getSearchURL(false),
'add' => PluginDatabaseinventoryCredential::getFormURL(false),
];
}

return $menu;
Expand Down

0 comments on commit 2ac1dd9

Please sign in to comment.