adding array support for output methods in Shell

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5560 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-08-21 14:17:45 +00:00
parent 74d16fc110
commit b0c21b9297

View file

@ -325,6 +325,13 @@ class Shell extends Object {
* @param boolean $newline If true, the outputs gets an added newline. * @param boolean $newline If true, the outputs gets an added newline.
*/ */
function out($string, $newline = true) { function out($string, $newline = true) {
if(is_array($string)) {
$str = '';
foreach($string as $message) {
$str .= $message ."\n";
}
$string = $str;
}
return $this->Dispatch->stdout($string, $newline); return $this->Dispatch->stdout($string, $newline);
} }
/** /**
@ -333,6 +340,13 @@ class Shell extends Object {
* @param string $string Error text to output. * @param string $string Error text to output.
*/ */
function err($string) { function err($string) {
if(is_array($string)) {
$str = '';
foreach($string as $message) {
$str .= $message ."\n";
}
$string = $str;
}
return $this->Dispatch->stderr($string."\n"); return $this->Dispatch->stderr($string."\n");
} }
/** /**