mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Making first parameter of Shell::out() and err() optional.
This commit is contained in:
parent
86274357b9
commit
0f6bca7496
2 changed files with 12 additions and 4 deletions
|
@ -363,13 +363,14 @@ class Shell extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a single or multiple messages to stdout.
|
* Outputs a single or multiple messages to stdout. If no parameters
|
||||||
|
* are passed outputs just a newline.
|
||||||
*
|
*
|
||||||
* @param mixed $message A string or a an array of strings to output
|
* @param mixed $message A string or a an array of strings to output
|
||||||
* @param integer $newlines Number of newlines to append
|
* @param integer $newlines Number of newlines to append
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function out($message, $newlines = 1) {
|
function out($message = null, $newlines = 1) {
|
||||||
if (is_array($message)) {
|
if (is_array($message)) {
|
||||||
$message = implode($this->nl(), $message);
|
$message = implode($this->nl(), $message);
|
||||||
}
|
}
|
||||||
|
@ -377,13 +378,14 @@ class Shell extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs a single or multiple error messages to stderr.
|
* Outputs a single or multiple error messages to stderr. If no parameters
|
||||||
|
* are passed outputs just a newline.
|
||||||
*
|
*
|
||||||
* @param mixed $message A string or a an array of strings to output
|
* @param mixed $message A string or a an array of strings to output
|
||||||
* @param integer $newlines Number of newlines to append
|
* @param integer $newlines Number of newlines to append
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function err($message, $newlines = 1) {
|
function err($message = null, $newlines = 1) {
|
||||||
if (is_array($message)) {
|
if (is_array($message)) {
|
||||||
$message = implode($this->nl(), $message);
|
$message = implode($this->nl(), $message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,9 @@ class ShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Shell->Dispatch->expectAt(2, 'stdout', array("Just\na\ntest\n\n", false));
|
$this->Shell->Dispatch->expectAt(2, 'stdout', array("Just\na\ntest\n\n", false));
|
||||||
$this->Shell->out(array('Just', 'a', 'test'), 2);
|
$this->Shell->out(array('Just', 'a', 'test'), 2);
|
||||||
|
|
||||||
|
$this->Shell->Dispatch->expectAt(3, 'stdout', array("\n", false));
|
||||||
|
$this->Shell->out();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,6 +255,9 @@ class ShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Shell->Dispatch->expectAt(2, 'stderr', array("Just\na\ntest\n\n"));
|
$this->Shell->Dispatch->expectAt(2, 'stderr', array("Just\na\ntest\n\n"));
|
||||||
$this->Shell->err(array('Just', 'a', 'test'), 2);
|
$this->Shell->err(array('Just', 'a', 'test'), 2);
|
||||||
|
|
||||||
|
$this->Shell->Dispatch->expectAt(3, 'stderr', array("\n", false));
|
||||||
|
$this->Shell->err();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue