cvs: pear-core /PEAR/Command Common.php
| From: | Greg Beaver | Date: | Sun, 05 Mar 2006 21:31:41 +0000 |
| Subject: | cvs: pear-core /PEAR/Command Common.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-4615@lists.php.net to get a copy of this message | ||
cellog Sun Mar 5 21:31:41 2006 UTC
Modified files:
/pear-core/PEAR/Command Common.php
Log:
remove err suppression @
use [] instead of {} for string access because of
PHP 6
http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/Command/Common.php?r1=1.32&r2=1.33&diff_format=u
Index: pear-core/PEAR/Command/Common.php
diff -u pear-core/PEAR/Command/Common.php:1.32 pear-core/PEAR/Command/Common.php:1.33
--- pear-core/PEAR/Command/Common.php:1.32 Thu Mar 2 16:39:14 2006
+++ pear-core/PEAR/Command/Common.php Sun Mar 5 21:31:41 2006
@@ -16,7 +16,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Common.php,v 1.32 2006/03/02 16:39:14 pajoye Exp $
+ * @version CVS: $Id: Common.php,v 1.33 2006/03/05 21:31:41 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -145,7 +145,12 @@
if (isset($shortcuts[$command])) {
$command = $shortcuts[$command];
}
- return @$this->commands[$command]['options'];
+ if (isset($this->commands[$command]) &&
+ isset($this->commands[$command]['options'])) {
+ return $this->commands[$command]['options'];
+ } else {
+ return null;
+ }
}
// }}}
@@ -192,12 +197,19 @@
function getHelp($command)
{
$config = &PEAR_Config::singleton();
- $help = @$this->commands[$command]['doc'];
+ if (!isset($this->commands[$command])) {
+ return "No such command \"$command\"";
+ }
+ $help = null;
+ if (isset($this->_commands[$command]['doc'])) {
+ $help = $this->commands[$command]['doc'];
+ }
if (empty($help)) {
// XXX (cox) Fallback to summary if there is no doc (show both?)
- if (!$help = @$this->commands[$command]['summary']) {
+ if (!isset($this->commands[$command]['summary'])) {
return "No help for command \"$command\"";
}
+ $help = $this->commands[$command]['summary'];
}
if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) {
foreach($matches[0] as $k => $v) {
@@ -223,7 +235,7 @@
$help = "Options:\n";
foreach ($this->commands[$command]['options'] as $k => $v) {
if (isset($v['arg'])) {
- if ($v['arg']{0} == '(') {
+ if ($v['arg'][0] == '(') {
$arg = substr($v['arg'], 1, -1);
$sapp = " [$arg]";
$lapp = "[=$arg]";
@@ -236,9 +248,9 @@
}
if (isset($v['shortopt'])) {
$s = $v['shortopt'];
- @$help .= " -$s$sapp, --$k$lapp\n";
+ $help .= " -$s$sapp, --$k$lapp\n";
} else {
- @$help .= " --$k$lapp\n";
+ $help .= " --$k$lapp\n";
}
$p = " ";
$doc = rtrim(str_replace("\n", "\n$p", $v['doc']));