src/TextExtension.php
public function truncate($value, $length, $replace = '...')
    {
        if (!isset($value)) {
            return null;
        }
        
        return strlen($value) <= $length ? $value : substr($value, 0, $length - strlen($replace)) . $replace;
    }
public function truncate($value, $length, $replace = '...')
    {
        if (!isset($value)) {
            return null;
        }
        
        return strlen($value) <= $length ? $value : substr($value, 0, $length - strlen($replace)) . $replace;
    }
public function truncate ( $ value , $ length , $ replace = '...' ) { if ( ! isset ( $ value ) ) { return null ; } return strlen ( $ value ) <= $ length ? $ value : substr ( $ value , 0 , $ length - strlen ( $ replace ) ) . $ replace ; }
Cut of text if it's to long.

@param string $value
@param int    $length
@param string $replace
@return string
Cut of text if it s to long .