From: Marcus Boerger Date: Thu, 24 May 2007 22:07:45 +0000 (+0000) Subject: - Type was meant to be named typ on purpose - change back X-Git-Tag: RELEASE_1_4~80 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2a18cc7db0dfde52e8ca2272552e9072e5f3b89;p=php - Type was meant to be named typ on purpose - change back --- diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc index a36425ae89..3b7934c3c2 100755 --- a/ext/phar/phar/clicommand.inc +++ b/ext/phar/phar/clicommand.inc @@ -20,14 +20,14 @@ abstract class CLICommand protected $argv; protected $cmds = array(); protected $args = array(); - protected $types = array(); + protected $typs = array(); function __construct($argc, array $argv) { $this->argc = $argc; $this->argv = $argv; $this->cmds = self::getCommands($this); - $this->types = self::getArgTyps($this); + $this->typs = self::getArgTyps($this); if ($argc < 2) { self::error("No command given, check ${argv[0]} help\n"); @@ -92,12 +92,12 @@ abstract class CLICommand exit($exit_code); } - function checkArgType($arg, $i, $argc, $argv) + function checkArgTyp($arg, $i, $argc, $argv) { - $typ = $this->args[$arg]['type']; + $typ = $this->args[$arg]['typ']; - if (isset($this->types[$type]['type'])) { - return call_user_func(array($this, $this->types[$type]['type']), $argv[$i], $this->args[$arg], $arg); + if (isset($this->typs[$typ]['typ'])) { + return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg); } else { return $argv[$i]; } @@ -139,16 +139,16 @@ abstract class CLICommand static function getArgTyps(CLICommand $cmdclass) { - return self::getSubFuncs($cmdclass, 'cli_arg_', array('type')); + return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ')); } - static function cli_arg_type_bool($arg, $cfg, $key) + static function cli_arg_typ_bool($arg, $cfg, $key) { return (bool)$arg; } - static function cli_arg_type_int($arg, $cfg, $key) + static function cli_arg_typ_int($arg, $cfg, $key) { if ((int)$arg != $arg) { self::error("Argument to -$key must be an integer.\n"); @@ -157,7 +157,7 @@ abstract class CLICommand return (int)$arg; } - static function cli_arg_type_regex($arg, $cfg, $key) + static function cli_arg_typ_regex($arg, $cfg, $key) { if (strlen($arg)) { @@ -176,7 +176,7 @@ abstract class CLICommand } } - static function cli_arg_type_select($arg, $cfg, $key) + static function cli_arg_typ_select($arg, $cfg, $key) { if (!in_array($arg, array_keys($cfg['select']))) { self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n"); @@ -184,7 +184,7 @@ abstract class CLICommand return $arg; } - static function cli_arg_type_dir($arg, $cfg, $key) + static function cli_arg_typ_dir($arg, $cfg, $key) { $f = realpath($arg); @@ -194,7 +194,7 @@ abstract class CLICommand return $f; } - static function cli_arg_type_file($arg) + static function cli_arg_typ_file($arg) { $f = new SplFileInfo($arg); $f = $f->getRealPath(); @@ -206,7 +206,7 @@ abstract class CLICommand return $f; } - static function cli_arg_type_filenew($arg, $cfg, $key) + static function cli_arg_typ_filenew($arg, $cfg, $key) { $d = dirname($arg); $f = realpath($d); @@ -217,9 +217,9 @@ abstract class CLICommand return $f . substr($arg, strlen($d));; } - static function cli_arg_type_filecont($arg, $cfg, $key) + static function cli_arg_typ_filecont($arg, $cfg, $key) { - return file_get_contents(self::cli_arg_type_file($arg, $cfg, $key)); + return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key)); } function cli_get_SP2($l1, $arg_inf) @@ -296,7 +296,7 @@ abstract class CLICommand function cli_cmd_arg_help() { - return array('' => array('type'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.')); + return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.')); } function cli_cmd_run_help() diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index 7a33a0d042..2df4189f80 100755 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -58,12 +58,12 @@ class PharCommand extends CLICommand { $phar_args = array( 'a' => array( - 'type' => 'alias', + 'typ' => 'alias', 'val' => NULL, 'inf' => ' Provide an alias name for the phar file.' ), 'c' => array( - 'type' => 'compalg', + 'typ' => 'compalg', 'val' => NULL, 'inf' => ' Compression algorithm.', 'select' => array( @@ -73,53 +73,53 @@ class PharCommand extends CLICommand ) ), 'e' => array( - 'type' => 'entry', + 'typ' => 'entry', 'val' => NULL, 'inf' => ' Name of entry to work on (must include PHAR internal directory name if any).' ), 'f' => array( - 'type' => $phartype, + 'typ' => $phartype, 'val' => NULL, 'inf' => ' Specifies the phar file to work on.' ), 'h' => array( - 'type' => 'select', + 'typ' => 'select', 'val' => NULL, 'inf' => ' Selects the hash algorithmn.', 'select' => array('md5' => 'MD5','sha1' => 'SHA1') ), 'i' => array( - 'type' => 'regex', + 'typ' => 'regex', 'val' => NULL, 'inf' => ' Specifies a regular expression for input files.' ), 'k' => array( - 'type' => 'any', + 'typ' => 'any', 'val' => NULL, 'inf' => ' Subscription index to work on.', ), 'l' => array( - 'type' => 'int', + 'typ' => 'int', 'val' => 0, 'inf' => ' Number of preceeding subdirectories to strip from file entries', ), 'm' => array( - 'type' => 'any', + 'typ' => 'any', 'val' => NULL, 'inf' => ' Meta data to store with entry (serialized php data).' ), 'p' => array( - 'type' => 'file', + 'typ' => 'file', 'val' => NULL, 'inf' => ' Location of PHP_Archive class file (pear list-files PHP_Archive).', ), 's' => array( - 'type' => 'file', + 'typ' => 'file', 'val' => NULL, 'inf' => ' Select the stub file.' ), 'x' => array( - 'type' => 'regex', + 'typ' => 'regex', 'val' => NULL, 'inf' => ' Regular expression for input files to exclude.' ), @@ -176,39 +176,40 @@ class PharCommand extends CLICommand return substr($haystack, -strlen($needle)) == $needle; } // }}} - // {{{ static function cli_arg_type_pharnew + // {{{ static function cli_arg_typ_pharnew /** - * New phar + * Argument type new phar * * @param string $arg The new phar component. * @param string $cfg Configuration to pass to a new file * @param string $key The key * @return string $arg The new argument file. */ - static function cli_arg_type_pharnew($arg, $cfg, $key) + static function cli_arg_typ_pharnew($arg, $cfg, $key) { - $arg = self::cli_arg_type_filenew($arg, $cfg, $key); + $arg = self::cli_arg_typ_filenew($arg, $cfg, $key); if (!Phar::isValidPharFilename($arg)) { self::error("Phar files must have file extension '.phar', '.phar.php', '.phar.bz2' or 'phar.gz'.\n"); } return $arg; } // }}} - // {{{ static function cli_arg_type_pharfile + // {{{ static function cli_arg_typ_pharfile /** - * Phar file + * Argument type existing Phar file * - * Return a file from a phar archive. + * Return filenam eof an existing Phar. * * @param string $arg The file in the phar to open. * @param string $cfg The configuration information * @param string $key The key information. - * @return string $pharfile The loaded phar file. + * @return string $pharfile The name of the loaded Phar file. + * @note The Phar will be loaded */ - static function cli_arg_type_pharfile($arg, $cfg, $key) + static function cli_arg_typ_pharfile($arg, $cfg, $key) { try { - $pharfile = self::cli_arg_type_file($arg, $cfg, $key); + $pharfile = self::cli_arg_typ_file($arg, $cfg, $key); if (!Phar::loadPhar($pharfile)) { self::error("Unable to open phar '$arg'\n"); @@ -220,67 +221,68 @@ class PharCommand extends CLICommand } } // }}} - // {{{ static function cli_arg_type_pharurl + // {{{ static function cli_arg_typ_pharurl /** - * Phar url-like + * Argument type Phar url-like * - * Return a file using a url like call + * Check the argument as cli_arg_Typ_phar and return its name prefixed + * with phar:// * * Ex: * * $arg = 'pharchive.phar/file.php'; - * cli_arg_type_pharurl($arg) + * cli_arg_typ_pharurl($arg) * * * @param string $arg The url-like phar archive to retrieve. * @return string The phar file-archive. */ - static function cli_arg_type_pharurl($arg, $cfg, $key) + static function cli_arg_typ_pharurl($arg, $cfg, $key) { - return 'phar://' . self::cli_arg_type_pharfile($arg, $cfg, $key); + return 'phar://' . self::cli_arg_typ_pharfile($arg, $cfg, $key); } // }}} - // {{{ static function cli_arg_type_phar + // {{{ static function cli_arg_typ_phar /** - * Cli type phar + * Cli argument type phar * * @param string $arg The phar archive to use. * @return object new Phar of the passed argument. */ - static function cli_arg_type_phar($arg, $cfg, $key) + static function cli_arg_typ_phar($arg, $cfg, $key) { try { - return new Phar(self::cli_arg_type_pharfile($arg, $cfg, $key)); + return new Phar(self::cli_arg_typ_pharfile($arg, $cfg, $key)); } catch(Exception $e) { self::error("Exception while opening phar '$argv':\n" . $e->getMessage() . "\n"); } } // }}} - // {{{ static function cli_arg_type_entry + // {{{ static function cli_arg_typ_entry /** - * Type Entry + * Argument type Entry name * * @param string $arg The argument (the entry) * @return string $arg The entry itself. */ - static function cli_arg_type_entry($arg, $cfg, $key) + static function cli_arg_typ_entry($arg, $cfg, $key) { // no further check atm, maybe check for no '/' at beginning return $arg; } // }}} - // {{{ static function cli_arg_type_compalg + // {{{ static function cli_arg_typ_compalg /** - * Enter description here... + * Argument type compression algorithm * * @param string $arg The phar selection * @param string $cfg The config option. * @param string $key The key information. - * @return string $arg The phar select + * @return string $arg The selected algorithm */ - static function cli_arg_type_compalg($arg, $cfg, $key) + static function cli_arg_typ_compalg($arg, $cfg, $key) { - $arg = self::cli_arg_type_select($arg, $cfg, $key); + $arg = self::cli_arg_typ_select($arg, $cfg, $key); switch($arg) { case 'auto': @@ -322,7 +324,7 @@ class PharCommand extends CLICommand $args = self::phar_args('acFhilpsx', 'pharnew'); $args[''] = array( - 'type' => 'any', + 'typ' => 'any', 'val' => NULL, 'required' => 1, 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching thegiven regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.',