public function truncate($text, $length = 15)
    {
        if (!$this->isValidLength($text, $length)) return $text;
        return (\strlen($text) > $length) ? $this->left($text, $length) . '...' : $text;
    }
public function truncate($text, $length = 15)
    {
        if (!$this->isValidLength($text, $length)) return $text;
        return (\strlen($text) > $length) ? $this->left($text, $length) . '...' : $text;
    }
public function truncate ( $ text , $ length = 15 ) { if ( ! $ this -> isValidLength ( $ text , $ length ) ) return $ text ; return ( \ strlen ( $ text ) > $ length ) ? $ this -> left ( $ text , $ length ) . '...' : $ text ; }
Truncates the string at the given length

@param  string $text
@param  int    $length
@return string
Truncates the string at the given length