public function append($string)
    {
        // Grab the current encoding
        $encoding = $this->str->getEncoding();

        if ($string instanceof Str)
        {
            // Ensure the encoding's match of both strings
            if ($string->getEncoding() !== $encoding)
            {
                throw new MisMatchedEncodingException();
            }

            $toBeAppended = $string;
        }
        else
        {
            // Ensure the incoming string is string like... Str will throw
            // exceptions if not. We also make the assumption that any "scalar"
            // strings are in the same encoding as the internal Str object.
            $toBeAppended = new Str($string, $encoding);
        }

        // Create the new Str object
        $this->str = new Str($this->str.$toBeAppended, $encoding);

        // Return ourselves to enable method chaining.
        return $this;
    }
public function append($string)
    {
        // Grab the current encoding
        $encoding = $this->str->getEncoding();

        if ($string instanceof Str)
        {
            // Ensure the encoding's match of both strings
            if ($string->getEncoding() !== $encoding)
            {
                throw new MisMatchedEncodingException();
            }

            $toBeAppended = $string;
        }
        else
        {
            // Ensure the incoming string is string like... Str will throw
            // exceptions if not. We also make the assumption that any "scalar"
            // strings are in the same encoding as the internal Str object.
            $toBeAppended = new Str($string, $encoding);
        }

        // Create the new Str object
        $this->str = new Str($this->str.$toBeAppended, $encoding);

        // Return ourselves to enable method chaining.
        return $this;
    }
public function append ( $ string ) { // Grab the current encoding $ encoding = $ this -> str -> getEncoding ( ) ; if ( $ string instanceof Str ) { // Ensure the encoding's match of both strings if ( $ string -> getEncoding ( ) !== $ encoding ) { throw new MisMatchedEncodingException ( ) ; } $ toBeAppended = $ string ; } else { // Ensure the incoming string is string like... Str will throw // exceptions if not. We also make the assumption that any "scalar" // strings are in the same encoding as the internal Str object. $ toBeAppended = new Str ( $ string , $ encoding ) ; } // Create the new Str object $ this -> str = new Str ( $ this -> str . $ toBeAppended , $ encoding ) ; // Return ourselves to enable method chaining. return $ this ; }
Appends a copy of the specified string to this instance.

@param  string|Str $string The string to append.

@return static
Appends a copy of the specified string to this instance .