_logStream = $stream;
return $this;
}
/**
* Retrieve log stream
*
* @return string
*/
public function getLogStream()
{
return $this->_logStream;
}
/**
* Echo data from executed command
*/
public function output($data)
{
$this->_out = $data;
if ('stdout'===$this->_logStream) {
if (is_string($data)) {
echo $data."
".str_repeat(" ", 256);
} elseif (is_array($data)) {
$data = array_pop($data);
if (!empty($data['message']) && is_string($data['message'])) {
echo $data['message']."
".str_repeat(" ", 256);
} elseif (!empty($data['data'])) {
if (is_string($data['data'])) {
echo $data['data']."
".str_repeat(" ", 256);
} else {
if (isset($data['title'])) {
echo $data['title']."
".str_repeat(" ", 256);
}
if (is_array($data['data'])) {
foreach ($data['data'] as $row) {
foreach ($row as $msg) {
echo " ".$msg;
}
echo "
".str_repeat(" ", 256);
}
} else {
echo " ".$data['data'];
}
}
}
} else {
print_r($data);
}
}
}
/**
* Method for ask client about rewrite all files.
*
* @param $string
*/
public function confirm($string)
{
$formId = $_POST['form_id'];
echo <<
SCRIPT;
}
/**
* Retrieve output cache
*
* @param bool $clearPrevious
* @return array|mixed
*/
public function getOutput($clearPrevious = false)
{
return $this->_out;
}
}