stdout() public method

You may optionally format the string with ANSI codes by passing additional parameters using the constants defined in [[\yii\helpers\Console]]. Example: $this->stdout('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE);
public stdout ( string $string ) : integer | boolean
$string string the string to print
return integer | boolean Number of bytes printed or false on error
Example #1
0
 /**
  *  If in daemon mode - no write to console
  *
  * @param string $string
  *
  * @return bool|int
  */
 public function stdout($string)
 {
     if (!$this->demonize && is_resource(STDOUT)) {
         return parent::stdout($string);
     } else {
         return false;
     }
 }
 /**
  * Overridden method honors $quiet option to disable
  * all non-error output.
  *
  * @param string      $string
  * @param bool        $verbose   If TRUE, message is considered as verbose
  * @param string|bool $timestamp If set, messages are timestamped by specified format or default format
  *
  * @return bool|int|string
  */
 public function stdout($string, $verbose = false, $timestamp = false)
 {
     if (!$verbose || $this->verbose) {
         if ($timestamp) {
             $timestamp = is_string($timestamp) ? $timestamp : 'd-m-Y H:i:s';
             $currentTime = date_create();
             $string = "[{$currentTime->format($timestamp)}] {$string}";
         }
         return !$this->quiet ? parent::stdout($string) : '';
     }
     return '';
 }