original_string: public function truncate($message, $length, $suffix = '...')
      {
          $computedLength = $length - $this->strlen($suffix);
  
          if ($computedLength > $this->strlen($message)) {
              return $message;
          }
  
          if (false === $encoding = mb_detect_encoding($message, null, true)) {
              return substr($message, 0, $length).$suffix;
          }
  
          return mb_substr($message, 0, $length, $encoding).$suffix;
      }
code: public function truncate($message, $length, $suffix = '...')
      {
          $computedLength = $length - $this->strlen($suffix);
  
          if ($computedLength > $this->strlen($message)) {
              return $message;
          }
  
          if (false === $encoding = mb_detect_encoding($message, null, true)) {
              return substr($message, 0, $length).$suffix;
          }
  
          return mb_substr($message, 0, $length, $encoding).$suffix;
      }
code_tokens: public function truncate ( $ message , $ length , $ suffix = '...' ) { $ computedLength = $ length - $ this -> strlen ( $ suffix ) ; if ( $ computedLength > $ this -> strlen ( $ message ) ) { return $ message ; } if ( false === $ encoding = mb_detect_encoding ( $ message , null , true ) ) { return substr ( $ message , 0 , $ length ) . $ suffix ; } return mb_substr ( $ message , 0 , $ length , $ encoding ) . $ suffix ; }
docstring: Truncates a message to the given length.
  
  @param string $message
  @param int    $length
  @param string $suffix
  
  @return string
docstring_tokens: Truncates a message to the given length .