]> granicus.if.org Git - php/commitdiff
- Make remainder arguments be typ-agnostic
authorMarcus Boerger <helly@php.net>
Thu, 10 May 2007 23:34:13 +0000 (23:34 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 10 May 2007 23:34:13 +0000 (23:34 +0000)
- Remove debug message

ext/phar/phar.php
ext/phar/phar/clicommand.inc

index b30193f78eee14dfa3b9b44add70de5fd5bdd83e..08764328469d6d6ad88b79bf625285c23f8d4350 100644 (file)
@@ -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();
index 9aa132cb2e121555bd5fb5011765ab4038eb878d..1bea0847c7da20c15021c8d011e9ba1cee0c47bd 100755 (executable)
@@ -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";