src/Csv.php
protected function _check_count($char, $array, $depth, $preferred) {
        if ($depth === count($array)) {
            $first = null;
            $equal = null;
            $almost = false;
            foreach ($array as $key => $value) {
                if ($first == null) {
                    $first = $value;
                } elseif ($value == $first && $equal !== false) {
                    $equal = true;
                } elseif ($value == $first + 1 && $equal !== false) {
                    $equal = true;
                    $almost = true;
                } else {
                    $equal = false;
                }
            }

            if ($equal) {
                $match = $almost ? 2 : 1;
                $pref = strpos($preferred, $char);
                $pref = ($pref !== false) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999';

                return $pref . $match . '.' . (99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
            } else {
                return false;
            }
        }
        return false;
    }
protected function _check_count($char, $array, $depth, $preferred) {
        if ($depth === count($array)) {
            $first = null;
            $equal = null;
            $almost = false;
            foreach ($array as $key => $value) {
                if ($first == null) {
                    $first = $value;
                } elseif ($value == $first && $equal !== false) {
                    $equal = true;
                } elseif ($value == $first + 1 && $equal !== false) {
                    $equal = true;
                    $almost = true;
                } else {
                    $equal = false;
                }
            }

            if ($equal) {
                $match = $almost ? 2 : 1;
                $pref = strpos($preferred, $char);
                $pref = ($pref !== false) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999';

                return $pref . $match . '.' . (99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
            } else {
                return false;
            }
        }
        return false;
    }
protected function _check_count ( $ char , $ array , $ depth , $ preferred ) { if ( $ depth === count ( $ array ) ) { $ first = null ; $ equal = null ; $ almost = false ; foreach ( $ array as $ key => $ value ) { if ( $ first == null ) { $ first = $ value ; } elseif ( $ value == $ first && $ equal !== false ) { $ equal = true ; } elseif ( $ value == $ first + 1 && $ equal !== false ) { $ equal = true ; $ almost = true ; } else { $ equal = false ; } } if ( $ equal ) { $ match = $ almost ? 2 : 1 ; $ pref = strpos ( $ preferred , $ char ) ; $ pref = ( $ pref !== false ) ? str_pad ( $ pref , 3 , '0' , STR_PAD_LEFT ) : '999' ; return $ pref . $ match . '.' . ( 99999 - str_pad ( $ first , 5 , '0' , STR_PAD_LEFT ) ) ; } else { return false ; } } return false ; }
Check if passed info might be delimiter
Only used by find_delimiter

@param  string $char      Potential field separating character
@param  array  $array     Frequency
@param  int    $depth     Number of analyzed rows
@param  string $preferred Preferred delimiter characters

@return string|false      special string used for delimiter selection, or false
Check if passed info might be delimiter Only used by find_delimiter