Fix code style issues

This commit is contained in:
Thilina Hasantha
2019-07-28 10:23:45 +02:00
parent 4a4d895592
commit cae28f03a5
4 changed files with 28 additions and 19 deletions

View File

@@ -90,9 +90,9 @@ class AttendanceRestEndPoint extends RestEndPoint
} }
if ($user->user_level !== 'Admin' && !PermissionManager::manipulationAllowed( if ($user->user_level !== 'Admin' && !PermissionManager::manipulationAllowed(
BaseService::getInstance()->getCurrentProfileId(), BaseService::getInstance()->getCurrentProfileId(),
$this->getModelObject($parameter) $this->getModelObject($parameter)
) )
) { ) {
return new IceResponse(IceResponse::ERROR, self::RESPONSE_ERR_PERMISSION_DENIED, 403); return new IceResponse(IceResponse::ERROR, self::RESPONSE_ERR_PERMISSION_DENIED, 403);
} }
@@ -277,8 +277,16 @@ class AttendanceRestEndPoint extends RestEndPoint
} }
} }
protected function savePunch($employeeId, $inDateTime, $note = null, $outDateTime = null, $id = null, $latitude = null, $longitude = null, $ip = null) protected function savePunch(
{ $employeeId,
$inDateTime,
$note = null,
$outDateTime = null,
$id = null,
$latitude = null,
$longitude = null,
$ip = null
) {
$employee = BaseService::getInstance()->getElement( $employee = BaseService::getInstance()->getElement(
'Employee', 'Employee',
$employeeId, $employeeId,
@@ -399,6 +407,5 @@ class AttendanceRestEndPoint extends RestEndPoint
} }
return null; return null;
} }
} }

View File

@@ -35,25 +35,27 @@ class Timezone extends BaseModel
$modifiedTimeZones[] = $tz; $modifiedTimeZones[] = $tz;
} catch (\Exception $e) { } catch (\Exception $e) {
} }
} }
usort($modifiedTimeZones, function ($a, $b) { return strcmp($a->details, $b->details); }); usort($modifiedTimeZones, function ($a, $b) {
return strcmp($a->details, $b->details);
});
return $modifiedTimeZones; return $modifiedTimeZones;
} }
public function formatOffset($offset) { public function formatOffset($offset)
{
$hours = $offset / 3600; $hours = $offset / 3600;
$remainder = $offset % 3600; $remainder = $offset % 3600;
$sign = $hours > 0 ? '+' : '-'; $sign = $hours > 0 ? '+' : '-';
$hour = (int) abs($hours); $hour = (int) abs($hours);
$minutes = (int) abs($remainder / 60); $minutes = (int) abs($remainder / 60);
if ($hour == 0 AND $minutes == 0) { if ($hour == 0 and $minutes == 0) {
$sign = ' '; $sign = ' ';
} }
return 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT) return 'GMT' . $sign . str_pad($hour, 2, '0', STR_PAD_LEFT)
.':'. str_pad($minutes,2, '0'); .':'. str_pad($minutes, 2, '0');
} }
public function fieldValueMethods() public function fieldValueMethods()

View File

@@ -3,7 +3,6 @@
namespace Settings\Rest; namespace Settings\Rest;
use Classes\IceResponse; use Classes\IceResponse;
use Classes\RestEndPoint; use Classes\RestEndPoint;
use Classes\SettingsManager; use Classes\SettingsManager;

View File

@@ -7,20 +7,21 @@ class NetworkUtils
public static function getClientIp() public static function getClientIp()
{ {
$ipaddress = ''; $ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP'])) if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ipaddress = $_SERVER['HTTP_CLIENT_IP']; $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED'])) } elseif (isset($_SERVER['HTTP_X_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED']; $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) } elseif (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_FORWARDED'])) } elseif (isset($_SERVER['HTTP_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED']; $ipaddress = $_SERVER['HTTP_FORWARDED'];
else if(isset($_SERVER['REMOTE_ADDR'])) } elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ipaddress = $_SERVER['REMOTE_ADDR']; $ipaddress = $_SERVER['REMOTE_ADDR'];
else } else {
$ipaddress = 'UNKNOWN'; $ipaddress = 'UNKNOWN';
}
return $ipaddress; return $ipaddress;
} }
} }