From b6247c367c8142381208b117f5daf83f410d5194 Mon Sep 17 00:00:00 2001 From: Susann Sgorzaly Date: Mon, 26 Feb 2018 08:31:46 +0100 Subject: [PATCH] reformat code; only extended comment for new function --- src/Csv.php | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Csv.php b/src/Csv.php index bed8292..5a07658 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -1,4 +1,5 @@ file_data)){ + public function getTotalRowCount() { + if (empty($this->file_data)) { return false; } $this->_detect_and_remove_sep_row_from_data($this->file_data); - $pattern = sprintf('/("[^%s]*")|[^%s]*/i',$this->enclosure, $this->enclosure); - preg_match_all($pattern,$this->file_data, $matches); + $pattern = sprintf('/("[^%s]*")|[^%s]*/i', $this->enclosure, $this->enclosure); + preg_match_all($pattern, $this->file_data, $matches); - foreach ($matches[0] as $match){ - if (empty($match) || !preg_match("/{$this->enclosure}/", $match)){ + foreach ($matches[0] as $match) { + if (empty($match) || !preg_match("/{$this->enclosure}/", $match)) { continue; } @@ -950,12 +952,19 @@ class Csv { */ protected function _validate_row_condition($row, $condition) { $operators = array( - '=', 'equals', 'is', - '!=', 'is not', - '<', 'is less than', - '>', 'is greater than', - '<=', 'is less than or equals', - '>=', 'is greater than or equals', + '=', + 'equals', + 'is', + '!=', + 'is not', + '<', + 'is less than', + '>', + 'is greater than', + '<=', + 'is less than or equals', + '>=', + 'is greater than or equals', 'contains', 'does not contain', );