src/Parser/Parse.php
public function splitOnSingleNewlineOccurrences(string $insert, bool $newlines = false): array
    {
        $new_deltas = [];

        $single_matches = preg_split("/[\n]{1,}/", $insert);

        foreach ($single_matches as $k => $sub_match) {

            $final_append = null;
            if ($k === count($single_matches) - 1 && $newlines === true) {
                $final_append = "\n\n";
            }

            $append = null;
            if ($k !== count($single_matches) - 1) {
                $append = "\n";
            }

            $new_deltas[] = [
                'insert' => $sub_match . ($final_append !== null ? $final_append : $append)
            ];
        }

        return $new_deltas;
    }
public function splitOnSingleNewlineOccurrences(string $insert, bool $newlines = false): array
    {
        $new_deltas = [];

        $single_matches = preg_split("/[\n]{1,}/", $insert);

        foreach ($single_matches as $k => $sub_match) {

            $final_append = null;
            if ($k === count($single_matches) - 1 && $newlines === true) {
                $final_append = "\n\n";
            }

            $append = null;
            if ($k !== count($single_matches) - 1) {
                $append = "\n";
            }

            $new_deltas[] = [
                'insert' => $sub_match . ($final_append !== null ? $final_append : $append)
            ];
        }

        return $new_deltas;
    }
public function splitOnSingleNewlineOccurrences ( string $ insert , bool $ newlines = false ) : array { $ new_deltas = [ ] ; $ single_matches = preg_split ( "/[\n]{1,}/" , $ insert ) ; foreach ( $ single_matches as $ k => $ sub_match ) { $ final_append = null ; if ( $ k === count ( $ single_matches ) - 1 && $ newlines === true ) { $ final_append = "\n\n" ; } $ append = null ; if ( $ k !== count ( $ single_matches ) - 1 ) { $ append = "\n" ; } $ new_deltas [ ] = [ 'insert' => $ sub_match . ( $ final_append !== null ? $ final_append : $ append ) ] ; } return $ new_deltas ; }
Check and split on single new line occurrences

@param string $insert
@param boolean $newlines Append multiple new lines

@return array
Check and split on single new line occurrences