Example #1
0
 /**
  * Writes string to output.
  *
  * @access  public
  * @param   string  $string  String to write
  * @param   int     $writer  Output type
  */
 public function write($string, $writer = Output::STANDARD)
 {
     if ($this->muted) {
         return;
     }
     $writer = $writer === static::STANDARD ? $this->standard : $this->error;
     if ($this->formatter !== null) {
         if ($writer->isDirect()) {
             $string = $this->formatter->format($string);
         } else {
             $string = $this->formatter->strip($string);
         }
     }
     $writer->write($string);
 }
Example #2
0
 /**
  * Returns the width of the string without formatting.
  *
  * @access  protected
  * @param   string     $string  String to strip
  * @return  string
  */
 protected function stringWidthWithoutFormatting($string)
 {
     return mb_strwidth($this->formatter !== null ? $this->formatter->strip($string) : $string);
 }