Classes/Econic/CsvReader/Reader.php
public function parse() {

		$lines = str_getcsv($this->source, $this->newline, $this->enclosure, $this->escape);

		// add keys from headline if available
		if ($this->getSourceHasHeadline()) {
			$keys = explode($this->delimiter, $lines[0]);
			$this->addKeys($keys);
			unset($lines[0]);
		}

		foreach ($lines as $line) { // iterate over all lines
			
			$values = str_getcsv($line, $this->delimiter, $this->enclosure, $this->escape); // save values in an array
			
			
			foreach ($values as $key => $value) {
				/* remove the escape character, because PHP doesn't do it
				 * https://bugs.php.net/bug.php?id=55413
				 */
				$values[$key] = str_replace($this->escape.$this->enclosure, $this->enclosure, $value);
				// trim all values if trimming is enabled
				if ($this->trim) {
					$values[$key] = trim($values[$key]);
				}
			}
			
			$dataset = array(); // create dataset
			foreach ($values as $position => $rawValue) { // iterate over all values
				$key = isset($this->keys[$position]) ? $this->keys[$position] : $position; // use the property number or a given key as index
				
				$processedValue = $rawValue;

				if (isset($this->modifiers[$key])) { // if there are registered modifiers for that key, let them do their work
					foreach ((array)$this->modifiers[$key] as $modifier) {
						$processedValue = call_user_func($modifier, $processedValue);
					}
				}
				
				$dataset[$key] = $processedValue;
			}

			$this->result[] = $dataset; // add dataset to the final result

		}
		return $this->result;
	}
public function parse() {

		$lines = str_getcsv($this->source, $this->newline, $this->enclosure, $this->escape);

		// add keys from headline if available
		if ($this->getSourceHasHeadline()) {
			$keys = explode($this->delimiter, $lines[0]);
			$this->addKeys($keys);
			unset($lines[0]);
		}

		foreach ($lines as $line) { // iterate over all lines
			
			$values = str_getcsv($line, $this->delimiter, $this->enclosure, $this->escape); // save values in an array
			
			
			foreach ($values as $key => $value) {
				/* remove the escape character, because PHP doesn't do it
				 * https://bugs.php.net/bug.php?id=55413
				 */
				$values[$key] = str_replace($this->escape.$this->enclosure, $this->enclosure, $value);
				// trim all values if trimming is enabled
				if ($this->trim) {
					$values[$key] = trim($values[$key]);
				}
			}
			
			$dataset = array(); // create dataset
			foreach ($values as $position => $rawValue) { // iterate over all values
				$key = isset($this->keys[$position]) ? $this->keys[$position] : $position; // use the property number or a given key as index
				
				$processedValue = $rawValue;

				if (isset($this->modifiers[$key])) { // if there are registered modifiers for that key, let them do their work
					foreach ((array)$this->modifiers[$key] as $modifier) {
						$processedValue = call_user_func($modifier, $processedValue);
					}
				}
				
				$dataset[$key] = $processedValue;
			}

			$this->result[] = $dataset; // add dataset to the final result

		}
		return $this->result;
	}
public function parse ( ) { $ lines = str_getcsv ( $ this -> source , $ this -> newline , $ this -> enclosure , $ this -> escape ) ; // add keys from headline if available if ( $ this -> getSourceHasHeadline ( ) ) { $ keys = explode ( $ this -> delimiter , $ lines [ 0 ] ) ; $ this -> addKeys ( $ keys ) ; unset ( $ lines [ 0 ] ) ; } foreach ( $ lines as $ line ) { // iterate over all lines $ values = str_getcsv ( $ line , $ this -> delimiter , $ this -> enclosure , $ this -> escape ) ; // save values in an array foreach ( $ values as $ key => $ value ) { /* remove the escape character, because PHP doesn't do it
				 * https://bugs.php.net/bug.php?id=55413
				 */ $ values [ $ key ] = str_replace ( $ this -> escape . $ this -> enclosure , $ this -> enclosure , $ value ) ; // trim all values if trimming is enabled if ( $ this -> trim ) { $ values [ $ key ] = trim ( $ values [ $ key ] ) ; } } $ dataset = array ( ) ; // create dataset foreach ( $ values as $ position => $ rawValue ) { // iterate over all values $ key = isset ( $ this -> keys [ $ position ] ) ? $ this -> keys [ $ position ] : $ position ; // use the property number or a given key as index $ processedValue = $ rawValue ; if ( isset ( $ this -> modifiers [ $ key ] ) ) { // if there are registered modifiers for that key, let them do their work foreach ( ( array ) $ this -> modifiers [ $ key ] as $ modifier ) { $ processedValue = call_user_func ( $ modifier , $ processedValue ) ; } } $ dataset [ $ key ] = $ processedValue ; } $ this -> result [ ] = $ dataset ; // add dataset to the final result } return $ this -> result ; }
main function, parses the source and returns the result array

@return array result
main function parses the source and returns the result array