Set the CSV controls

@param string $delimiter
@param string $enclosure

@return CsvExport
761936
public function setControls($delimiter, $enclosure)
	{
		$this->delimiter = $delimiter;
		$this->enclosure = $enclosure;
		return $this;
	}
850043
public function filter($value)
    {
        return str_getcsv($value, $this->delimiter, $this->enclosure, $this->escape);
    }
159168
public function removeWordDelimiter ($delimiter)
    {
        if (empty($delimiter)) {
            throw new Exception('Word delimiter cannot be null.');
        }
        if (is_array($delimiter)) {
            foreach ($delimiter as $delim) {
                $this->removeWordDelimiter($delim);
            }
        } else {
            if (! in_array($delimiter, $this->getWordDelimiters())) {
                throw new Exception("Word delimiter '$delimiter' is not in delimiters array.");
            }
            $newArray = array();
            foreach ($this->_wordDelimiters as $delim) {
                if ($delim != $delimiter) {
                    $newArray[] = $delim;
                }
                $this->_wordDelimiters = $newArray;
            }
        }
        return $this;
    }
548273
public function innerXml($delimiter = '')
    {
        $innerXml = [];

        foreach ($this->node->childNodes as $childNode) {
            $innerXml[] = $childNode->ownerDocument->saveXML($childNode);
        }

        return implode($delimiter, $innerXml);
    }
1034902
public function explode(string $delimiter, int $limit = PHP_INT_MAX): TextVector
    {
        $pieces = explode($delimiter, $this->text, $limit);

        return TextVector::make($pieces);
    }
776101
public static function csvFileToArray($filename='', $delimiter=',')
    {
        $header = null;
        $data = [];
        if (($handle = fopen($filename, 'r')) !== false) {
            while (($row = fgetcsv($handle, 1000, $delimiter)) !== false) {
                if (!$header) {
                    $header = $row;
                } else {
                    $data[] = array_combine($header, $row);
                }
            }
            fclose($handle);
        }

        return $data;
    }
260035
public function getParameterListAsObject($name, $delimiter = ";")
    {

        $parameter = $this->getValidParameterOfType($name, "string");
        $list = preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $parameter, null,
            PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        //if emptyparameter return throw an exception because they'd be expecting an object;


        $parameters = [];
        $values = [];

        foreach ($list as $itemValue) {
            //if items have qualities associated with them we shall sort the parameter array by qualities;
            $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0,
                PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
            $value = array_shift($bits);
            $attributes = [];

            $lastNullAttribute = null;
            foreach ($bits as $bit) {
                if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1))
                    && ($start === '"'
                        || $start === '\'')
                ) {
                    $attributes[$lastNullAttribute] = substr($bit, 1, -1);
                } elseif ('=' === $end) {
                    $lastNullAttribute = $bit = substr($bit, 0, -1);
                    $attributes[$bit] = null;
                } else {
                    $parts = explode('=', $bit);
                    $attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : '';
                }
            }

            $parameters[($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ($start === '"' || $start === '\'')
                ? substr($value, 1, -1) : $value] = $attributes;

        }

        return new Factory($name, $parameters, static::$sanitizer, static::$validator, false);
    }
1104110
static public function getCsv( $handle, $length = null, $delimiter = ',', $enclosure = '"' )
    {
        $separator = preg_quote( $delimiter );
        $quoteSymbol = preg_quote( $enclosure );

        $line = '';
        $eof = false;
        do {
            $line .= ( $length === null ? fgets( $handle ) : fgets( $handle, (int) $length ) );
            $eof = ( preg_match_all( '/' . $quoteSymbol . '/', $line ) % 2 == 0 );
        }
        while ( !$eof );
        if ( empty( $line ) ) {
            return false;
        }

        $csvPattern = '/(' . $quoteSymbol . '[^' . $quoteSymbol . ']*(?:' . $quoteSymbol . $quoteSymbol . '[^' . $quoteSymbol . ']*)*' . $quoteSymbol . '|[^' . $separator . ']*)' . $separator . '/';
        $csvLine = preg_replace( '/(?: |[ ])?$/', $separator, trim( $line ) );
        $matches = null;
        preg_match_all( $csvPattern, $csvLine, $matches );
        $row = $matches[1];
        for ( $col = 0; $col < count( $row ); $col++ ) {
            $row[$col] = preg_replace( '/^' . $quoteSymbol . '(.*)' . $quoteSymbol . '$/s', '$1', $row[$col] );
            $row[$col] = str_replace( $quoteSymbol . $quoteSymbol, $quoteSymbol, $row[$col] );
        }
        return $row;
    }
497439
protected static function stringToArray(
        string $delimiter,
        int $limit = PHP_INT_MAX,
        RuleInterface $next = null
    ): RuleInterface {
        return $next === null ?
            new StringToArray($delimiter, $limit) : new AndOperator(new StringToArray($delimiter, $limit), $next);
    }
1096655
public static function parse(
        string $csv,
        string $delimiter = ',',
        string $enclosure = '"',
        string $escape = '\\'
    ): Bag {
        $row = str_getcsv($csv, $delimiter, $enclosure, $escape);

        return Bag::from(array_map('trim', $row));
    }
985468
public function _setTokenStart($delimiter)
    {
        if (
            !($delimiter instanceof Stringable) &&
            !is_string($delimiter) &&
            !is_null($delimiter)
        ) {
            throw $this->_createInvalidArgumentException($this->__('Invalid token start delimiter'), null, null, $delimiter);
        }

        $this->tokenStart = $delimiter;
    }
738785
protected function createOutputContents(
        array $header,
        $delimiter = ',',
        $enclosure = '"',
        $toConvert = true
    )
    {
        $fp = fopen("php://temp", 'r+b');

        // header
        if ($header) {
            fputcsv($fp, $header, $delimiter, $enclosure);
        }

        foreach ($this->rows as $row) {
            fputcsv($fp, $row, $delimiter, $enclosure);
        }

        rewind($fp);

        $buffer = stream_get_contents($fp);

        if ($toConvert === false) {
            fclose($fp);
            return $buffer;
        }

        $ret = $this->convert($buffer);

        fclose($fp);

        return $ret;
    }
166383
public function set(string $container, $object, ConfigInterface $config = null): ContainersInterface
    {
        if (!$this->has($container)) {
            if (\is_object($object)) {
                $this->setContainer($container, $object);
            } else {
                $class = '\\DrMVC\\' . $object;
                $this->setContainer($container, new $class($config));
            }
        }
        return $this;
    }
1212085
public function addExportCsvFiltered(
		$text,
		$csv_file_name,
		$output_encoding = null,
		$delimiter = null,
		$include_bom = false
	) {
		return $this->addToExports(new Export\ExportCsv(
			$this,
			$text,
			$csv_file_name,
			true,
			$output_encoding,
			$delimiter,
			$include_bom
		));
	}
1086857
public function parse( $data = null, $type = null, $delimiter = null ) {

		if ( ! empty( $data ) ) {
			$this->input = $data;
		}

		if ( ! empty( $type ) && in_array( $type, $this->types, true ) ) {
			$this->type = $type;
		}

		if ( !empty( $delimiter ) )
			$this->delimiter = $delimiter;

		if ( method_exists( $this, "parse_{$this->type}" ) ) {
			return call_user_func( array( $this, 'parse_' . $this->type ) );
		}

		return $this->parsed;
	}
327406
public static function csvFileToArrayGenerator(string $filename = '', string $delimiter = ',')
    {
        $complete = false;
        try {
            $header = null;
            if (($handle = fopen($filename, 'r')) !== false) {
                while (($row = fgetcsv($handle, 4096, $delimiter)) !== false) {
                    if (!$header) {
                        $header = $row;
                    } else {
                        yield array_combine($header, $row);
                    }
                }
            }
            $complete = true;
        } finally {
            if (!$complete) {
                // cleanup when loop breaks
            } else {
                // cleanup when loop completes
            }
        }
        // Do something only after loop completes
    }
38909
public function separator($firstLines, $delimiter='"')
    {
        $lines = $this->toCheckableLines($firstLines);

        $separatorsByCount = $this->sortSeparatorsByHighestCount($lines[0], $delimiter);
        $highestCount = max(array_keys($separatorsByCount));

        // If the highest count of colums is smaller than 2 there should be
        // no separator at all. If the next lines are seem to have more than one
        // detection should fail.
        if ($highestCount < 2) {
            return '';
        }

        foreach ($separatorsByCount as $count=>$separators) {
            if ($count < 2) {
                continue;
            }
            foreach ($separators as $separator) {
                if (!$this->eachLineHasColumnCountOf($lines, $count, $separator, $delimiter)) {
                    continue;
                }
                return $separator;
            }
        }

        // if we didnt find an applicable separator until here we have to fail
        throw new DetectionFailedException("The csv file seems to have $highestCount columns but the following lines contains another count of columns");
    }