Permalink
Browse files

Fix code style issues.

  • Loading branch information...
1 parent f1fbf18 commit ba462b0d4dde95e49c192bf992fe53a25f8a6d42 @eddieajau eddieajau committed Mar 27, 2013
Showing with 83 additions and 83 deletions.
  1. +83 −83 libraries/joomla/input/cli.php
@@ -116,87 +116,87 @@ public function unserialize($input)
*
* @since 11.1
*/
- protected function parseArguments()
- {
- $argv = $_SERVER['argv'];
-
- $this->executable = array_shift($argv);
-
- $out = array();
-
- for ($i = 0, $j = count($argv); $i < $j; $i++)
- {
- $arg = $argv[$i];
-
- // --foo --bar=baz
- if (substr($arg, 0, 2) === '--')
- {
- $eqPos = strpos($arg, '=');
-
- // --foo
- if ($eqPos === false)
- {
- $key = substr($arg, 2);
-
- // --foo value
- if ($i + 1 < $j && $argv[$i + 1][0] !== '-')
- {
- $value = $argv[$i + 1];
- $i++;
- }
- else
- {
- $value = isset($out[$key]) ? $out[$key] : true;
- }
- $out[$key] = $value;
- }
-
- // --bar=baz
- else
- {
- $key = substr($arg, 2, $eqPos - 2);
- $value = substr($arg, $eqPos + 1);
- $out[$key] = $value;
- }
- }
-
- // -k=value -abc
- else if (substr($arg, 0, 1) === '-')
- {
- // -k=value
- if (substr($arg, 2, 1) === '=')
- {
- $key = substr($arg, 1, 1);
- $value = substr($arg, 3);
- $out[$key] = $value;
- }
- // -abc
- else
- {
- $chars = str_split(substr($arg, 1));
- foreach ($chars as $char)
- {
- $key = $char;
- $value = isset($out[$key]) ? $out[$key] : true;
- $out[$key] = $value;
- }
-
- // -a a-value
- if ((count($chars) === 1) && ($i + 1 < $j) && ($argv[$i + 1][0] !== '-'))
- {
- $out[$key] = $argv[$i + 1];
- $i++;
- }
- }
- }
-
- // plain-arg
- else
- {
- $this->args[] = $arg;
- }
- }
-
- $this->data = $out;
- }
+ protected function parseArguments()
+ {
+ $argv = $_SERVER['argv'];
+
+ $this->executable = array_shift($argv);
+
+ $out = array();
+
+ for ($i = 0, $j = count($argv); $i < $j; $i++)
+ {
+ $arg = $argv[$i];
+
+ // --foo --bar=baz
+ if (substr($arg, 0, 2) === '--')
+ {
+ $eqPos = strpos($arg, '=');
+
+ // --foo
+ if ($eqPos === false)
+ {
+ $key = substr($arg, 2);
+
+ // --foo value
+ if ($i + 1 < $j && $argv[$i + 1][0] !== '-')
+ {
+ $value = $argv[$i + 1];
+ $i++;
+ }
+ else
+ {
+ $value = isset($out[$key]) ? $out[$key] : true;
+ }
+
+ $out[$key] = $value;
+ }
+
+ // --bar=baz
+ else
+ {
+ $key = substr($arg, 2, $eqPos - 2);
+ $value = substr($arg, $eqPos + 1);
+ $out[$key] = $value;
+ }
+ }
+ elseif (substr($arg, 0, 1) === '-')
+ // -k=value -abc
+ {
+ // -k=value
+ if (substr($arg, 2, 1) === '=')
+ {
+ $key = substr($arg, 1, 1);
+ $value = substr($arg, 3);
+ $out[$key] = $value;
+ }
+ else
+ // -abc
+ {
+ $chars = str_split(substr($arg, 1));
+
+ foreach ($chars as $char)
+ {
+ $key = $char;
+ $value = isset($out[$key]) ? $out[$key] : true;
+ $out[$key] = $value;
+ }
+
+ // -a a-value
+ if ((count($chars) === 1) && ($i + 1 < $j) && ($argv[$i + 1][0] !== '-'))
+ {
+ $out[$key] = $argv[$i + 1];
+ $i++;
+ }
+ }
+ }
+ else
+ {
+ // Plain-arg
+ $this->args[] = $arg;
+ }
+ }
+
+ $this->data = $out;
+ }
}

0 comments on commit ba462b0

Please sign in to comment.