Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug Fix detectDelimiterList by adding COUNT_RECURSIVE
Discussion see #55 At the moment detectDelimiterList method doesn't find the correct delimiter when there are 2 or more potential delimiters in the csv line. For example if there are 30 semicolons (;) and only one comma (,) in the checked csv line the method doesn't find the correct delimiter anymore and returns only both found occurences (";" and ","). This is because fetchRowsCountByDelimiter method (when we use default $nb_rows = 1 value) always prints 1 for both found delimiters as a result regardless if there are 30 semicolons and only one comma there. So I added the COUNT_RECURSIVE mode in fetchRowsCountByDelimiter method in order we get a relation how often a delimiter is present in the line(s). In the detectDelimiterList method we can then change the return line so it only returns the delimiter with the most occurences. To make that even more robust we return only one delimiter if it's occurence is way higher then the occurence of the 2nd found delimiter (I choosed 2.5x the times here). If its quantity is not way higher we return all found delimiters like it is now.