From 0c4a804db1c144c1bf03bc1ac13079bf1e7e3cff Mon Sep 17 00:00:00 2001 From: William Knauss Date: Thu, 5 Jun 2014 20:52:23 -0400 Subject: [PATCH] _check_count --- parsecsv.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/parsecsv.lib.php b/parsecsv.lib.php index ccdfb71..8729062 100644 --- a/parsecsv.lib.php +++ b/parsecsv.lib.php @@ -1112,19 +1112,19 @@ class parseCSV { * @return special string used for delimiter selection, or false */ protected function _check_count ($char, $array, $depth, $preferred) { - if ( $depth == count($array) ) { + if ($depth == count($array)) { $first = null; $equal = null; $almost = false; - foreach( $array as $key => $value ) { - if ( $first == null ) { + foreach ($array as $key => $value) { + if ($first == null) { $first = $value; } - elseif ( $value == $first && $equal !== false) { + elseif ($value == $first && $equal !== false) { $equal = true; } - elseif ( $value == $first+1 && $equal !== false ) { - $equal = true; + elseif ($value == $first+1 && $equal !== false) { + $equal = true; $almost = true; } else { @@ -1132,10 +1132,10 @@ class parseCSV { } } - if ( $equal ) { - $match = ( $almost ) ? 2 : 1 ; + if ($equal) { + $match = ($almost) ? 2 : 1; $pref = strpos($preferred, $char); - $pref = ( $pref !== false ) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ; + $pref = ($pref !== false) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999'; return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT)); }