public function truncate($length, $ellipsis = '')
    {
        if (!$this->isNumber($length)) {
            throw new StringObjectException(StringObjectException::MSG_INVALID_ARG, [
                '$length',
                'integer'
            ]);
        }

        if (!$this->isString($ellipsis)) {
            throw new StringObjectException(StringObjectException::MSG_INVALID_ARG, [
                '$ellipsis',
                'string'
            ]);
        }

        if ($this->length() <= $length) {
            return $this;
        }

        if ($ellipsis != '') {
            $length = $length - strlen($ellipsis);
        }

        $this->wordWrap($length)->subString(0, $this->stringPosition("\n"));

        $this->val($this->val() . $ellipsis);

        return $this;
    }