function CsvEncoder::getCsvOptions
2 calls to CsvEncoder::getCsvOptions()
- CsvEncoder::decode in vendor/
symfony/ serializer/ Encoder/ CsvEncoder.php - Decodes a string into PHP data.
- CsvEncoder::encode in vendor/
symfony/ serializer/ Encoder/ CsvEncoder.php - Encodes data into the given format.
File
-
vendor/
symfony/ serializer/ Encoder/ CsvEncoder.php, line 239
Class
- CsvEncoder
- Encodes CSV data.
Namespace
Symfony\Component\Serializer\EncoderCode
private function getCsvOptions(array $context) : array {
$delimiter = $context[self::DELIMITER_KEY] ?? $this->defaultContext[self::DELIMITER_KEY];
$enclosure = $context[self::ENCLOSURE_KEY] ?? $this->defaultContext[self::ENCLOSURE_KEY];
$escapeChar = $context[self::ESCAPE_CHAR_KEY] ?? $this->defaultContext[self::ESCAPE_CHAR_KEY];
$keySeparator = $context[self::KEY_SEPARATOR_KEY] ?? $this->defaultContext[self::KEY_SEPARATOR_KEY];
$headers = $context[self::HEADERS_KEY] ?? $this->defaultContext[self::HEADERS_KEY];
$escapeFormulas = $context[self::ESCAPE_FORMULAS_KEY] ?? $this->defaultContext[self::ESCAPE_FORMULAS_KEY];
$outputBom = $context[self::OUTPUT_UTF8_BOM_KEY] ?? $this->defaultContext[self::OUTPUT_UTF8_BOM_KEY];
$asCollection = $context[self::AS_COLLECTION_KEY] ?? $this->defaultContext[self::AS_COLLECTION_KEY];
if (!\is_array($headers)) {
throw new InvalidArgumentException(\sprintf('The "%s" context variable must be an array or null, given "%s".', self::HEADERS_KEY, get_debug_type($headers)));
}
return [
$delimiter,
$enclosure,
$escapeChar,
$keySeparator,
$headers,
$escapeFormulas,
$outputBom,
$asCollection,
];
}