protected function sortSeparatorsByHighestCount($line, $delimiter)
    {
        $separatorsByCount = [];

        foreach ($this->separators as $separator) {
            $data = str_getcsv($line, $separator, $delimiter);
            $count = count($data);

            if (!isset($separatorsByCount[$count])) {
                $separatorsByCount[$count] = [];
            }

            $separatorsByCount[$count][] = $separator;
        }

        $sorted = [];
        $counts = array_keys($separatorsByCount);

        rsort($counts, SORT_NUMERIC);

        foreach ($counts as $count) {
            $sorted[$count] = $separatorsByCount[$count];
        }

        return $sorted;
    }
protected function sortSeparatorsByHighestCount($line, $delimiter)
    {
        $separatorsByCount = [];

        foreach ($this->separators as $separator) {
            $data = str_getcsv($line, $separator, $delimiter);
            $count = count($data);

            if (!isset($separatorsByCount[$count])) {
                $separatorsByCount[$count] = [];
            }

            $separatorsByCount[$count][] = $separator;
        }

        $sorted = [];
        $counts = array_keys($separatorsByCount);

        rsort($counts, SORT_NUMERIC);

        foreach ($counts as $count) {
            $sorted[$count] = $separatorsByCount[$count];
        }

        return $sorted;
    }
protected function sortSeparatorsByHighestCount ( $ line , $ delimiter ) { $ separatorsByCount = [ ] ; foreach ( $ this -> separators as $ separator ) { $ data = str_getcsv ( $ line , $ separator , $ delimiter ) ; $ count = count ( $ data ) ; if ( ! isset ( $ separatorsByCount [ $ count ] ) ) { $ separatorsByCount [ $ count ] = [ ] ; } $ separatorsByCount [ $ count ] [ ] = $ separator ; } $ sorted = [ ] ; $ counts = array_keys ( $ separatorsByCount ) ; rsort ( $ counts , SORT_NUMERIC ) ; foreach ( $ counts as $ count ) { $ sorted [ $ count ] = $ separatorsByCount [ $ count ] ; } return $ sorted ; }
Return an array keyed by the column count of each separator

@param string $line
@param string $delimiter

@return array
Return an array keyed by the column count of each separator