From 4466ec9cf908a8b0d4aca651246e10cfb6835c59 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 10 May 2007 23:34:13 +0000 Subject: [PATCH] - Make remainder arguments be typ-agnostic - Remove debug message --- ext/phar/phar.php | 25 +++++++++++++++---------- ext/phar/phar/clicommand.inc | 26 +++++++++++++++----------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/ext/phar/phar.php b/ext/phar/phar.php index b30193f78e..0876432846 100644 --- a/ext/phar/phar.php +++ b/ext/phar/phar.php @@ -114,16 +114,7 @@ if (!class_exists('CLICommand')) } else { - $typ = $this->args[$arg]['typ']; - - if (isset($this->typs[$typ]['typ'])) - { - $this->args[$arg]['val'] = call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]); - } - else - { - $this->args[$arg]['val'] = $argv[$i]; - } + $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv); } } else @@ -178,6 +169,20 @@ if (!class_exists('CLICommand')) call_user_func(array($this, $this->cmds[$command]['run']), $this->args); } + function checkArgTyp($arg, $i, $argc, $argv) + { + $typ = $this->args[$arg]['typ']; + + if (isset($this->typs[$typ]['typ'])) + { + return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]); + } + else + { + return $argv[$i]; + } + } + static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs) { $a = array(); diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc index 9aa132cb2e..1bea0847c7 100755 --- a/ext/phar/phar/clicommand.inc +++ b/ext/phar/phar/clicommand.inc @@ -63,16 +63,7 @@ abstract class CLICommand } else { - $typ = $this->args[$arg]['typ']; - - if (isset($this->typs[$typ]['typ'])) - { - $this->args[$arg]['val'] = call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]); - } - else - { - $this->args[$arg]['val'] = $argv[$i]; - } + $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv); } } else @@ -127,6 +118,20 @@ abstract class CLICommand call_user_func(array($this, $this->cmds[$command]['run']), $this->args); } + function checkArgTyp($arg, $i, $argc, $argv) + { + $typ = $this->args[$arg]['typ']; + + if (isset($this->typs[$typ]['typ'])) + { + return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg]); + } + else + { + return $argv[$i]; + } + } + static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs) { $a = array(); @@ -183,7 +188,6 @@ abstract class CLICommand static function cli_arg_typ_dir($arg) { $f = realpath($arg); -echo "DIR: '$arg' = '$f'\n"; if ($f===false || !file_exists($f) || !is_dir($f)) { echo "Requested path '$arg' does not exist.\n"; -- 2.50.1