Skip to content

Commit

Permalink
fix phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B committed Apr 25, 2024
1 parent 5f012bc commit f936f77
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 56 deletions.
4 changes: 3 additions & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<!-- exclude PascalCase format -->
<exclude name="PSR1.Classes.ClassDeclaration.notPascalCase" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>

14 changes: 7 additions & 7 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

class PluginEscaladeConfig extends CommonDBTM
{
static $rightname = 'config';
public static $rightname = 'config';

static function getTypeName($nb = 0)
public static function getTypeName($nb = 0)
{
return __("Configuration Escalade plugin", "escalade");
}
Expand All @@ -43,7 +43,7 @@ static function getTypeName($nb = 0)
* @param mixed $options
* @return void
*/
function showForm($ID, $options = [])
public function showForm($ID, $options = [])
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;
Expand All @@ -65,7 +65,7 @@ function showForm($ID, $options = [])
'rand' => $rand,
]);
echo Html::scriptBlock("
function hide_show_history(val) {
public function hide_show_history(val) {
var display = (val == 0) ? 'none' : '';
document.getElementById('show_history_td1').style.display = display;
document.getElementById('show_history_td2').style.display = display;
Expand Down Expand Up @@ -212,7 +212,7 @@ function hide_show_history(val) {
echo "</tr>";
echo "<tr><td>";
echo Html::scriptBlock("
function hide_technician_group(val) {
public function hide_technician_group(val) {
var display = (val == 0) ? 'none' : '';
document.getElementById('use_technican_group_details').style.display = display;
}
Expand Down Expand Up @@ -350,7 +350,7 @@ function hide_technician_group(val) {
echo "</div>";
}

static function loadInSession()
public static function loadInSession()
{
$config = new self();
$config->getFromDB(1);
Expand All @@ -373,7 +373,7 @@ static function loadInSession()
$_SESSION['plugins']['escalade']['config'] = $config->fields;
}

static function dropdownGenericStatus($itemtype, $name, $rand, $value = CommonITILObject::INCOMING)
private static function dropdownGenericStatus($itemtype, $name, $rand, $value = CommonITILObject::INCOMING)
{
$item = new $itemtype();

Expand Down
11 changes: 6 additions & 5 deletions inc/group_group.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
die("Sorry. You can't access directly to this file");
}

// phpcs:ignore
class PluginEscaladeGroup_Group extends CommonDBRelation
{
// From CommonDBRelation
Expand All @@ -41,15 +42,15 @@ class PluginEscaladeGroup_Group extends CommonDBRelation
public static $itemtype_2 = 'Group';
public static $items_id_2 = 'groups_id_destination';

function getForbiddenStandardMassiveAction()
public function getForbiddenStandardMassiveAction()
{
$forbidden = parent::getForbiddenStandardMassiveAction();
$forbidden[] = 'update';
return $forbidden;
}


function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if ($item instanceof Group) {
return __("Escalation", "escalade");
Expand All @@ -58,7 +59,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
}


static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
if ($item instanceof Group) {
$PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group();
Expand All @@ -68,7 +69,7 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem
}


function manageGroup($groups_id)
public function manageGroup($groups_id)
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;
Expand Down Expand Up @@ -134,7 +135,7 @@ function manageGroup($groups_id)
}
}

function getGroups($ticket_id, $removeAlreadyAssigned = true)
public function getGroups($ticket_id, $removeAlreadyAssigned = true)
{
$groups = $user_groups = $ticket_groups = [];

Expand Down
16 changes: 8 additions & 8 deletions inc/history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PluginEscaladeHistory extends CommonDBTM
{
const HISTORY_LIMIT = 4;

static function getFirstLineForTicket($tickets_id)
public static function getFirstLineForTicket($tickets_id)
{
$found = self::getFullHistory($tickets_id);
if (count($found) == 0) {
Expand All @@ -46,7 +46,7 @@ static function getFirstLineForTicket($tickets_id)
}
}

static function getlastLineForTicket($tickets_id)
public static function getlastLineForTicket($tickets_id)
{
$found = self::getFullHistory($tickets_id);
if (count($found) == 0) {
Expand All @@ -56,7 +56,7 @@ static function getlastLineForTicket($tickets_id)
}
}

static function getLastHistoryForTicketAndGroup($tickets_id, $groups_id, $previous_groups_id)
public static function getLastHistoryForTicketAndGroup($tickets_id, $groups_id, $previous_groups_id)
{
$history = new self();
$history->getFromDBByRequest(['ORDER' => 'date_mod DESC',
Expand All @@ -72,14 +72,14 @@ static function getLastHistoryForTicketAndGroup($tickets_id, $groups_id, $previo
return $history;
}

static function getFullHistory($tickets_id)
public static function getFullHistory($tickets_id)
{
$history = new self();
return $history->find(['tickets_id' => $tickets_id], "date_mod DESC");
}


static function getHistory($tickets_id, $full_history = false)
public static function getHistory($tickets_id, $full_history = false)
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;
Expand Down Expand Up @@ -158,7 +158,7 @@ static function getHistory($tickets_id, $full_history = false)
echo "</div>";
}

static function showGroupLink($group, $full_history = false)
private static function showGroupLink($group, $full_history = false)
{

if (!$group->can($group->fields['id'], READ)) {
Expand All @@ -178,13 +178,13 @@ static function showGroupLink($group, $full_history = false)
echo ">" . $group->getNameID(true) . "</a>";
}

static function showCentralList()
public static function showCentralList()
{
self::showCentralSpecificList("solved");
self::showCentralSpecificList("notold");
}

static function showCentralSpecificList($type)
private static function showCentralSpecificList($type)
{
/** @var array $CFG_GLPI */
/** @var DBmysql $DB */
Expand Down
24 changes: 12 additions & 12 deletions inc/notification.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PluginEscaladeNotification
* @param NotificationTarget $target the current NotificationTarget.
* we compute (atm) only NotificationTargetPlanningRecall
*/
static function addTargets(NotificationTarget $target)
public static function addTargets(NotificationTarget $target)
{
// only for Planning recall
if ($target instanceof NotificationTargetPlanningRecall) {
Expand Down Expand Up @@ -119,7 +119,7 @@ static function addTargets(NotificationTarget $target)
* @param NotificationTarget $target the current NotificationTarget.
* we compute (atm) only NotificationTargetPlanningRecall
*/
static function getActionTargets(NotificationTarget $target)
public static function getActionTargets(NotificationTarget $target)
{
if ($target instanceof NotificationTargetPlanningRecall) {
$item = new $target->obj->fields['itemtype']();
Expand All @@ -130,21 +130,21 @@ static function getActionTargets(NotificationTarget $target)

switch ($target->data['items_id']) {
// group's users
case self::NTRGT_TICKET_REQUESTER_GROUP:
case self::NTRGT_TICKET_REQUESTER_GROUP: // phpcs:ignore
$group_type = CommonITILActor::REQUESTER;
case self::NTRGT_TICKET_WATCH_GROUP:
case self::NTRGT_TICKET_WATCH_GROUP: // phpcs:ignore
if (!isset($group_type)) {
$group_type = CommonITILActor::OBSERVER;
}
case self::NTRGT_TICKET_TECH_GROUP:
$manager = 0;

// manager of group's users
case self::NTRGT_TICKET_REQUESTER_GROUP_MANAGER:
case self::NTRGT_TICKET_REQUESTER_GROUP_MANAGER: // phpcs:ignore
if (!isset($group_type)) {
$group_type = CommonITILActor::REQUESTER;
}
case self::NTRGT_TICKET_WATCH_GROUP_MANAGER:
case self::NTRGT_TICKET_WATCH_GROUP_MANAGER: // phpcs:ignore
if (!isset($group_type)) {
$group_type = CommonITILActor::OBSERVER;
}
Expand All @@ -160,9 +160,9 @@ static function getActionTargets(NotificationTarget $target)
break;

// users
case self::NTRGT_TICKET_REQUESTER_USER:
case self::NTRGT_TICKET_REQUESTER_USER: // phpcs:ignore
$user_type = CommonITILActor::REQUESTER;
case self::NTRGT_TICKET_WATCH_USER:
case self::NTRGT_TICKET_WATCH_USER: // phpcs:ignore
if (!isset($user_type)) {
$user_type = CommonITILActor::OBSERVER;
}
Expand All @@ -179,7 +179,7 @@ static function getActionTargets(NotificationTarget $target)
break;

// escalation groups
case self::NTRGT_TICKET_ESCALADE_GROUP:
case self::NTRGT_TICKET_ESCALADE_GROUP: // phpcs:ignore
$manager = 0;
case self::NTRGT_TICKET_ESCALADE_GROUP_MANAGER:
if (!isset($manager)) {
Expand All @@ -205,7 +205,7 @@ static function getActionTargets(NotificationTarget $target)
*
* @return void
*/
static function addGroupsOfTicket(
public static function addGroupsOfTicket(
NotificationTarget $target,
$tickets_id = 0,
$manager = 0,
Expand All @@ -229,7 +229,7 @@ static function addGroupsOfTicket(
*
* @return void
*/
static function addUsersOfTicket(
public static function addUsersOfTicket(
NotificationTarget $target,
$tickets_id = 0,
$user_type = CommonITILActor::REQUESTER
Expand All @@ -249,7 +249,7 @@ static function addUsersOfTicket(
}
}

static function getEvents(NotificationTarget $target)
public static function getEvents(NotificationTarget $target)
{
if ($target instanceof NotificationTargetTicket) {
$target->events['update_solvedate'] = __('Solve date modification', 'escalade');
Expand Down
Loading

0 comments on commit f936f77

Please sign in to comment.