public function write(Collection $sequences)
    {
        $sequences = clone $sequences;
        $expression = '';
        if ($sequences->count() > 0) {
            $sequences = $sequences->reverse();

            $length = $sequences->count();
            for ($i = 0; $i < $length; $i++) {
                $sequence = $sequences[$i];
                if (isset($sequences[$i + 1])) {
                    $next = $sequences[$i + 1];
                } else {
                    $next = null;
                }
                $expression = $this->getNextPart($sequence[0], $sequence[1], $next) . $expression;
            }
        }

        return $expression;
    }
public function write(Collection $sequences)
    {
        $sequences = clone $sequences;
        $expression = '';
        if ($sequences->count() > 0) {
            $sequences = $sequences->reverse();

            $length = $sequences->count();
            for ($i = 0; $i < $length; $i++) {
                $sequence = $sequences[$i];
                if (isset($sequences[$i + 1])) {
                    $next = $sequences[$i + 1];
                } else {
                    $next = null;
                }
                $expression = $this->getNextPart($sequence[0], $sequence[1], $next) . $expression;
            }
        }

        return $expression;
    }
public function write ( Collection $ sequences ) { $ sequences = clone $ sequences ; $ expression = '' ; if ( $ sequences -> count ( ) > 0 ) { $ sequences = $ sequences -> reverse ( ) ; $ length = $ sequences -> count ( ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ sequence = $ sequences [ $ i ] ; if ( isset ( $ sequences [ $ i + 1 ] ) ) { $ next = $ sequences [ $ i + 1 ] ; } else { $ next = null ; } $ expression = $ this -> getNextPart ( $ sequence [ 0 ] , $ sequence [ 1 ] , $ next ) . $ expression ; } } return $ expression ; }
Writes a sequence history to a string representation of the expression.

@param \Collection\Collection $sequences

@return string
Writes a sequence history to a string representation of the expression .