function explodeOnWhitespace($str) { return explodeOn(' ', $str); }
/** * If argument is a string, it explodes on comma * using \explodeOn because of strings that look like `",", "b"` (quoted commas) * @param mixed $param * @return array */ public static function csvToArray($param) { return is_string($param) ? array_filter(array_map('trim', \explodeOn(',', $param))) : $param; }
private function _getRemoteCSV() { // only use " " as escaped $conf = array('ignore' => array("'", "(")); $file = file_get_contents($this->path); $file = explodeOn("\n", $file, $conf); $csv = array(); $i = 0; foreach ($file as $row) { // if headers, skip the first row if ($i && $this->has_headers) { $i++; continue; } $csv[] = $this->_mapRow(explodeOn($this->delimiter, $row, $conf)); } return array_filter($csv); }