-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QA: Fixed bug #17670: Now can be disabled the echo of the result of s…
…entences with :set echo = false git-svn-id: http://svn.php.net/repository/pear/packages/PHP_Shell/trunk@302240 c90b9560-bf6c-de11-be94-00142212c4b1
- Loading branch information
Jesús Espino García
committed
Aug 14, 2010
1 parent
38c7bfd
commit 528df57
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
class PHP_Shell_Extensions_Echo implements PHP_Shell_Extension | ||
{ | ||
protected $opt_echo = true; | ||
|
||
/** | ||
* Register a command | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$opt = PHP_Shell_Options::getInstance(); | ||
$opt->registerOption('echo', $this, 'optSetEcho'); | ||
} | ||
|
||
/** | ||
* Set verbose | ||
* | ||
* @param string $key Unused | ||
* @param string $value One of 'false', 'on', etc | ||
* | ||
* @return void | ||
*/ | ||
public function optSetEcho($key, $value) | ||
{ | ||
switch($value) { | ||
case "true": | ||
case "on": | ||
case "1": | ||
$this->opt_echo = true; | ||
break; | ||
default: | ||
$this->opt_echo = false; | ||
break; | ||
} | ||
} | ||
|
||
/** | ||
* check if we have a echo print-out | ||
* | ||
* @return bool 1 if echo, 0 otherwise | ||
*/ | ||
public function isEcho() | ||
{ | ||
return $this->opt_echo; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters