original_string: public static function truncate(
          $value, $length = 80, $terminator = "\n", $preserve = false
      ) {
          $length = $preserve
              ? static::preserveBreakpoint($value, $length)
              : $length;
          if (mb_strlen($value) > $length) {
              $value = rtrim(mb_substr($value, 0, $length)).
                  $terminator;
          }
          return $value;
      }
code: public static function truncate(
          $value, $length = 80, $terminator = "\n", $preserve = false
      ) {
          $length = $preserve
              ? static::preserveBreakpoint($value, $length)
              : $length;
          if (mb_strlen($value) > $length) {
              $value = rtrim(mb_substr($value, 0, $length)).
                  $terminator;
          }
          return $value;
      }
code_tokens: public static function truncate ( $ value , $ length = 80 , $ terminator = "\n" , $ preserve = false ) { $ length = $ preserve ? static :: preserveBreakpoint ( $ value , $ length ) : $ length ; if ( mb_strlen ( $ value ) > $ length ) { $ value = rtrim ( mb_substr ( $ value , 0 , $ length ) ) . $ terminator ; } return $ value ; }
docstring: Truncates the value string with the provided length
  
  If the string length is lower the the desired truncate length
  the value is returned intact.
  
  If the string is bigger then the provided length then it will
  be cut and the a terminator will be added to the end of the string.
  
  If you specify $preserve arg as true the world will be preserved
  when cutting the string and the cut will occur on the next available
  space character counting from the provided length.
  
  @param string $value
  @param int    $length
  @param string $terminator
  @param bool   $preserve
  
  @return string The truncate string
docstring_tokens: Truncates the value string with the provided length