mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°8796 - Add PHP code style validation in iTop and extensions - format whole code base
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024 Combodo SAS
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// 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.
|
||||
@@ -16,7 +17,6 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
/**
|
||||
* Module itop-sla-computation: implements an extensible mechanism
|
||||
*
|
||||
@@ -55,7 +55,7 @@ class SLAComputation implements iWorkingTimeComputer
|
||||
if (($sClassName != 'SLAComputationAddOnAPI') && !is_subclass_of($sClassName, 'SLAComputationAddOnAPI')) {
|
||||
throw new CoreException("Could not select this module, the class '$sClassName' is not derived from SLAComputationAddOnAPI (parent class:".get_parent_class($sClassName)." )");
|
||||
}
|
||||
self::$m_oAddOn = new $sClassName;
|
||||
self::$m_oAddOn = new $sClassName();
|
||||
self::$m_oAddOn->Init();
|
||||
}
|
||||
|
||||
@@ -87,13 +87,11 @@ class SLAComputation implements iWorkingTimeComputer
|
||||
*/
|
||||
public function GetDeadline($oObject, $iDuration, DateTime $oStartDate)
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__);
|
||||
}
|
||||
$oEndDate = self::$m_oAddOn->GetDeadline($oObject, $iDuration, $oStartDate);
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration, WorkingTimeRecorder::COMPUTED_END);
|
||||
}
|
||||
|
||||
@@ -112,15 +110,17 @@ class SLAComputation implements iWorkingTimeComputer
|
||||
*/
|
||||
public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate)
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__);
|
||||
}
|
||||
$iDuration = self::$m_oAddOn->GetOpenDuration($oObject, $oStartDate, $oEndDate);
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration,
|
||||
WorkingTimeRecorder::COMPUTED_DURATION);
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::SetValues(
|
||||
$oStartDate->format('U'),
|
||||
$oEndDate->format('U'),
|
||||
$iDuration,
|
||||
WorkingTimeRecorder::COMPUTED_DURATION
|
||||
);
|
||||
}
|
||||
|
||||
return $iDuration;
|
||||
@@ -159,8 +159,7 @@ class SLAComputationAddOnAPI
|
||||
*/
|
||||
public static function GetDeadline($oTicket, $iDuration, DateTime $oStartDate)
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__);
|
||||
}
|
||||
// Default implementation: 24x7, no holidays: to compute the deadline, just add
|
||||
@@ -182,8 +181,7 @@ class SLAComputationAddOnAPI
|
||||
*/
|
||||
public static function GetOpenDuration($oTicket, DateTime $oStartDate, DateTime $oEndDate)
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder'))
|
||||
{
|
||||
if (class_exists('WorkingTimeRecorder')) {
|
||||
WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __class__.'::'.__function__);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user