From 9833a8f289df76988528b605d21f4580f33e3ea8 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sat, 2 May 2020 01:26:35 +0200 Subject: [PATCH] whitespace fix in __parseParams() --- scripts/postfixadmin-cli.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts/postfixadmin-cli.php b/scripts/postfixadmin-cli.php index 0ea75fa3..91c609d9 100644 --- a/scripts/postfixadmin-cli.php +++ b/scripts/postfixadmin-cli.php @@ -323,22 +323,20 @@ class PostfixAdmin { private function __parseParams($params) { $count = count($params); for ($i = 0; $i < $count; $i++) { -# if (isset($params[$i])) { - if ($params[$i] != '' && $params[$i]{0} === '-' && $params[$i] != '-1') { - $key = substr($params[$i], 1); - if (isset($params[$i+1])) { - # TODO: ideally we should know if a parameter can / must have a value instead of whitelisting known valid values starting with '-' (probably only bool doesn't need a value) - if ($params[$i+1]{0} === '-' && $params[$i+1] != '-1') { - $this->params[$key] = true; - } else { - $this->params[$key] = $params[$i+1]; - $i++; - } + if ($params[$i] != '' && $params[$i]{0} === '-' && $params[$i] != '-1') { + $key = substr($params[$i], 1); + if (isset($params[$i+1])) { + # TODO: ideally we should know if a parameter can / must have a value instead of whitelisting known valid values starting with '-' (probably only bool doesn't need a value) + if ($params[$i+1]{0} === '-' && $params[$i+1] != '-1') { + $this->params[$key] = true; + } else { + $this->params[$key] = $params[$i+1]; + $i++; } - } else { - $this->args[] = $params[$i]; } -# } + } else { + $this->args[] = $params[$i]; + } } }