From 4410c6b0373930da1ee643e6fa48d188040f2ba2 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Fri, 21 Jul 2023 03:19:40 +0200 Subject: [PATCH] Improve coding style according to PSR-12 --- Web/Modules/GPG.php | 4 +-- Web/Modules/SCP.php | 4 +-- Web/Modules/SSH.php | 6 ++--- Web/Pages/NewCopyJobWizard.php | 8 +++--- Web/Pages/NewMigrateJobWizard.php | 8 +++--- Web/Pages/NewVirtualFullJobWizard.php | 36 +++++++++++++++------------ Web/Pages/Security.php | 8 +++--- Web/Portlets/QuickResourceEdit.php | 9 ++++--- 8 files changed, 44 insertions(+), 39 deletions(-) diff --git a/Web/Modules/GPG.php b/Web/Modules/GPG.php index 0906505..63e7b4b 100644 --- a/Web/Modules/GPG.php +++ b/Web/Modules/GPG.php @@ -102,9 +102,9 @@ private function getCmdPattern($ptype) $pattern = null; switch ($ptype) { case self::PTYPE_REG_CMD: $pattern = self::GPG_COMMAND_PATTERN; - break; + break; default: $pattern = self::GPG_COMMAND_PATTERN; - break; + break; } return $pattern; } diff --git a/Web/Modules/SCP.php b/Web/Modules/SCP.php index 55a0ec0..917c77f 100644 --- a/Web/Modules/SCP.php +++ b/Web/Modules/SCP.php @@ -145,9 +145,9 @@ private function getCmdPattern($ptype) $pattern = null; switch ($ptype) { case self::PTYPE_REG_CMD: $pattern = self::SCP_COMMAND_PATTERN; - break; + break; default: $pattern = self::SCP_COMMAND_PATTERN; - break; + break; } return $pattern; } diff --git a/Web/Modules/SSH.php b/Web/Modules/SSH.php index 7c7e6ac..f41f362 100644 --- a/Web/Modules/SSH.php +++ b/Web/Modules/SSH.php @@ -196,11 +196,11 @@ private function getCmdPattern($ptype) $pattern = null; switch ($ptype) { case self::PTYPE_REG_CMD: $pattern = self::SSH_COMMAND_PATTERN; - break; + break; case self::PTYPE_BG_CMD: $pattern = self::SSH_BG_COMMAND_PATTERN; - break; + break; default: $pattern = self::SSH_COMMAND_PATTERN; - break; + break; } return $pattern; } diff --git a/Web/Pages/NewCopyJobWizard.php b/Web/Pages/NewCopyJobWizard.php index 32483de..530d685 100644 --- a/Web/Pages/NewCopyJobWizard.php +++ b/Web/Pages/NewCopyJobWizard.php @@ -607,13 +607,13 @@ public function getSelectionPatternControl() $sel_type = $this->SelectionType->getDirectiveValue(); switch ($sel_type) { case 'Job': $control = $this->SelectionPatternJob; - break; + break; case 'Client': $control = $this->SelectionPatternClient; - break; + break; case 'Volume': $control = $this->SelectionPatternVolume; - break; + break; case 'SQLQuery': $control = $this->SelectionPatternSQLQuery; - break; + break; } return $control; } diff --git a/Web/Pages/NewMigrateJobWizard.php b/Web/Pages/NewMigrateJobWizard.php index 0d8fa59..46de455 100644 --- a/Web/Pages/NewMigrateJobWizard.php +++ b/Web/Pages/NewMigrateJobWizard.php @@ -608,13 +608,13 @@ public function getSelectionPatternControl() $sel_type = $this->SelectionType->getDirectiveValue(); switch ($sel_type) { case 'Job': $control = $this->SelectionPatternJob; - break; + break; case 'Client': $control = $this->SelectionPatternClient; - break; + break; case 'Volume': $control = $this->SelectionPatternVolume; - break; + break; case 'SQLQuery': $control = $this->SelectionPatternSQLQuery; - break; + break; } return $control; } diff --git a/Web/Pages/NewVirtualFullJobWizard.php b/Web/Pages/NewVirtualFullJobWizard.php index 1b24f7a..3895e0b 100644 --- a/Web/Pages/NewVirtualFullJobWizard.php +++ b/Web/Pages/NewVirtualFullJobWizard.php @@ -165,7 +165,7 @@ public function isInJobDefs($directive_name, $directive_value) { $jobdefs = $this->getJobDefs(); if ($directive_name == 'Priority') { - $directive_value = (int)$directive_value; + $directive_value = (int) $directive_value; } $ret = (key_exists($directive_name, $jobdefs) && $jobdefs[$directive_name] === $directive_value); return $ret; @@ -405,6 +405,9 @@ public function setStorageClientSideValidators() /** * Storage control validator method. + * + * @param TRequiredFieldValidator $sender sender object + * @param null $param event parameter */ public function validateStorage($sender, $param) { @@ -474,10 +477,11 @@ public function loadPoolList($control) /** * Load normal and virtual full (NextPool) pools. * - * @param TCallback sender object - * @param TCallbackEventParameter callback parameter + * @param TCallback $sender sender object + * @param TCallbackEventParameter $param callback parameter */ - public function loadPools($sender, $param) { + public function loadPools($sender, $param) + { $this->loadNormalBackupPools(); $this->loadVirtualFullBackupNextPools(); } @@ -487,6 +491,7 @@ public function loadPools($sender, $param) { * Storage is taken from selected pool. * * @param string $pool pool name to get storage + * @param null|TCallbackEventParameter $param callback parameter */ public function setVirtualFullBackupStorage($pool, $param = null) { @@ -513,8 +518,8 @@ public function setVirtualFullBackupStorage($pool, $param = null) /** * Set control with virtual full backup storage. * - * @param TCallback sender object - * @param TCallbackEventParameter callback parameter + * @param TCallback $sender sender object + * @param TCallbackEventParameter $param callback parameter */ public function setVirtualFullBackupStorageValue($sender, $param) { @@ -584,7 +589,6 @@ public function loadMessages() $this->Messages->setDirectiveValue($def_msg); } $this->Messages->createDirective(); - } /** @@ -712,24 +716,24 @@ public function wizardCompleted($sender, $param) 'Level="%s" %s-%s %s', $this->VirtualFullScheduleBasicLevel->getValue(), Params::getDaysOfWeekConfig( - [(int)$this->VirtualFullScheduleBasicScheduleFrom->getSelectedValue()] + [(int) $this->VirtualFullScheduleBasicScheduleFrom->getSelectedValue()] ), Params::getDaysOfWeekConfig( - [(int)$this->VirtualFullScheduleBasicScheduleTo->getSelectedValue()] + [(int) $this->VirtualFullScheduleBasicScheduleTo->getSelectedValue()] ), Params::getTimeConfig( - [(int)$this->VirtualFullScheduleBasicScheduleAtHour->getSelectedValue()], - (int)$this->VirtualFullScheduleBasicScheduleAtHour->getSelectedValue() + [(int) $this->VirtualFullScheduleBasicScheduleAtHour->getSelectedValue()], + (int) $this->VirtualFullScheduleBasicScheduleAtHour->getSelectedValue() ) ), sprintf( 'Level="VirtualFull" %s %s', Params::getDaysOfWeekConfig( - [(int)$this->VirtualFullScheduleBasicScheduleRunVFOn->getSelectedValue()] + [(int) $this->VirtualFullScheduleBasicScheduleRunVFOn->getSelectedValue()] ), Params::getTimeConfig( - [(int)$this->VirtualFullScheduleBasicScheduleVFAtHour->getSelectedValue()], - (int)$this->VirtualFullScheduleBasicScheduleVFAtMinute->getSelectedValue() + [(int) $this->VirtualFullScheduleBasicScheduleVFAtHour->getSelectedValue()], + (int) $this->VirtualFullScheduleBasicScheduleVFAtMinute->getSelectedValue() ) ) ] @@ -784,7 +788,7 @@ public function wizardCompleted($sender, $param) $this->CreateResourceErrMsg->Text = $result->output; return; } - $job = (array)$result->output; + $job = (array) $result->output; $directives = ['NextPool']; if ($this->VirtualFullTypeProgressive->Checked) { $directives[] = 'BackupsToKeep'; @@ -818,7 +822,7 @@ public function wizardCompleted($sender, $param) $this->CreateResourceErrMsg->Text = $result->output; return; } - $pool = (array)$result->output; + $pool = (array) $result->output; $pool['Storage'] = $this->VirtualFullBackupStorage->getDirectiveValue(); $params = [ 'config', diff --git a/Web/Pages/Security.php b/Web/Pages/Security.php index a832a2a..fa9ce38 100644 --- a/Web/Pages/Security.php +++ b/Web/Pages/Security.php @@ -1036,13 +1036,13 @@ private function addLdapExtraParams(&$params) $crit = (int) ($this->GetUsersCriteria->SelectedValue); switch ($crit) { case self::IMPORT_CRIT_USERNAME: $params['filter_attr'] = $params['user_attr']; - break; + break; case self::IMPORT_CRIT_LONG_NAME: $params['filter_attr'] = $params['long_name_attr']; - break; + break; case self::IMPORT_CRIT_DESCRIPTION: $params['filter_attr'] = $params['desc_attr']; - break; + break; case self::IMPORT_CRIT_EMAIL: $params['filter_attr'] = $params['email_attr']; - break; + break; } $params['filter_val'] = $this->GetUsersCriteriaFilter->Text; } diff --git a/Web/Portlets/QuickResourceEdit.php b/Web/Portlets/QuickResourceEdit.php index c89b391..e1274b4 100644 --- a/Web/Portlets/QuickResourceEdit.php +++ b/Web/Portlets/QuickResourceEdit.php @@ -24,8 +24,8 @@ * @author Marcin Haba * @category Control */ -class QuickResourceEdit extends Portlets implements IActiveControl { - +class QuickResourceEdit extends Portlets implements IActiveControl +{ public const COMPONENT_TYPE = 'ComponentType'; public const RESOURCE_TYPE = 'ResourceType'; public const RESOURCE_NAME = 'ResourceName'; @@ -41,8 +41,9 @@ public function getActiveControl() return $this->getAdapter()->getBaseActiveControl(); } - public function openQuickResourceEdit($sender, $param) { - list($component_type, $resource_type, $resource_name) = $param->getCallbackParameter(); + public function openQuickResourceEdit($sender, $param) + { + [$component_type, $resource_type, $resource_name] = $param->getCallbackParameter(); $this->setComponentType($component_type); $this->setResourceType($resource_type); $this->setResourceName($resource_name);