protected function linesAddedOrModified(
        array $ancestor,
        array $local,
        array $remote,
        $count,
        $count_remote,
        $count_ancestor,
        $count_local
    ) {
        $merged = [];
        $counter = 0;
        // For all ancestors lines, it will check local and remote
        // and make sure only one of them has been edited.
        // Otherwise, throw an Exception.
        foreach ($ancestor as $key => $value) {
            $counter = $counter + 1;
            if ($ancestor[$key] == $local[$key]) {
                $merged[$key] = $remote[$key];
            } elseif ($ancestor[$key] == $remote[$key]
                || $local[$key] == $remote[$key]) {
                $merged[$key] = $local[$key];
            } else {
                throw new ConflictException("A conflict has occured");
            }
        }
        // Once done with ancestor lines, we have hunk of
        // lines added. We will add them as they are.
        // If the lines are added in both remote and local,
        // We will make sure they are same or throw exception.
        for ($i = $count_ancestor; $i < $count; $i++) {
            if ($count_ancestor == $count_remote) {
                $merged[$i] == $local[$i];
            } elseif ($count_ancestor == $count_local) {
                $merged[$i] = $remote[$i];
            } elseif ($count_local == $count_remote) {
                if ($local[$i] == $remote[$i]) {
                    $merged[$i] = $local[$i];
                } else {
                    throw new ConflictException("A conflict has occured");
                }
            }
        }
        return $merged;
    }
protected function linesAddedOrModified(
        array $ancestor,
        array $local,
        array $remote,
        $count,
        $count_remote,
        $count_ancestor,
        $count_local
    ) {
        $merged = [];
        $counter = 0;
        // For all ancestors lines, it will check local and remote
        // and make sure only one of them has been edited.
        // Otherwise, throw an Exception.
        foreach ($ancestor as $key => $value) {
            $counter = $counter + 1;
            if ($ancestor[$key] == $local[$key]) {
                $merged[$key] = $remote[$key];
            } elseif ($ancestor[$key] == $remote[$key]
                || $local[$key] == $remote[$key]) {
                $merged[$key] = $local[$key];
            } else {
                throw new ConflictException("A conflict has occured");
            }
        }
        // Once done with ancestor lines, we have hunk of
        // lines added. We will add them as they are.
        // If the lines are added in both remote and local,
        // We will make sure they are same or throw exception.
        for ($i = $count_ancestor; $i < $count; $i++) {
            if ($count_ancestor == $count_remote) {
                $merged[$i] == $local[$i];
            } elseif ($count_ancestor == $count_local) {
                $merged[$i] = $remote[$i];
            } elseif ($count_local == $count_remote) {
                if ($local[$i] == $remote[$i]) {
                    $merged[$i] = $local[$i];
                } else {
                    throw new ConflictException("A conflict has occured");
                }
            }
        }
        return $merged;
    }
protected function linesAddedOrModified ( array $ ancestor , array $ local , array $ remote , $ count , $ count_remote , $ count_ancestor , $ count_local ) { $ merged = [ ] ; $ counter = 0 ; // For all ancestors lines, it will check local and remote // and make sure only one of them has been edited. // Otherwise, throw an Exception. foreach ( $ ancestor as $ key => $ value ) { $ counter = $ counter + 1 ; if ( $ ancestor [ $ key ] == $ local [ $ key ] ) { $ merged [ $ key ] = $ remote [ $ key ] ; } elseif ( $ ancestor [ $ key ] == $ remote [ $ key ] || $ local [ $ key ] == $ remote [ $ key ] ) { $ merged [ $ key ] = $ local [ $ key ] ; } else { throw new ConflictException ( "A conflict has occured" ) ; } } // Once done with ancestor lines, we have hunk of // lines added. We will add them as they are. // If the lines are added in both remote and local, // We will make sure they are same or throw exception. for ( $ i = $ count_ancestor ; $ i < $ count ; $ i ++ ) { if ( $ count_ancestor == $ count_remote ) { $ merged [ $ i ] == $ local [ $ i ] ; } elseif ( $ count_ancestor == $ count_local ) { $ merged [ $ i ] = $ remote [ $ i ] ; } elseif ( $ count_local == $ count_remote ) { if ( $ local [ $ i ] == $ remote [ $ i ] ) { $ merged [ $ i ] = $ local [ $ i ] ; } else { throw new ConflictException ( "A conflict has occured" ) ; } } } return $ merged ; }
Handles the addition of lines.

@param array $ancestor
@param array $local
@param array $remote
@param $count
@param $count_remote
@param $count_ancestor
@param $count_local

@return array
@throws Exception
Handles the addition of lines .