diff --git a/src/Csv.php b/src/Csv.php index 74381e4..f75bb0d 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -1,6 +1,7 @@ titles = $head; if (!empty($this->sort_by)) { - $sort_type = SORT_REGULAR; - if ($this->sort_type == 'numeric') { - $sort_type = SORT_NUMERIC; - } elseif ($this->sort_type == 'string') { - $sort_type = SORT_STRING; - } - - $this->sort_reverse ? krsort($rows, $sort_type) : ksort($rows, $sort_type); + $this->sort_reverse ? krsort($rows, $this->sort_type) : ksort($rows, $this->sort_type); if ($this->offset !== null || $this->limit !== null) { $rows = array_slice($rows, ($this->offset === null ? 0 : $this->offset), $this->limit, true); diff --git a/src/enums/SortEnum.php b/src/enums/SortEnum.php new file mode 100644 index 0000000..01a37b0 --- /dev/null +++ b/src/enums/SortEnum.php @@ -0,0 +1,18 @@ +