Copied!

Encodes CSV data.

CloneableInstantiable
Constants
public Symfony\Component\Serializer\Encoder\CsvEncoder::AS_COLLECTION_KEY = 'as_collection'
public Symfony\Component\Serializer\Encoder\CsvEncoder::DELIMITER_KEY = 'csv_delimiter'
public Symfony\Component\Serializer\Encoder\CsvEncoder::ENCLOSURE_KEY = 'csv_enclosure'
public Symfony\Component\Serializer\Encoder\CsvEncoder::END_OF_LINE = 'csv_end_of_line'
public Symfony\Component\Serializer\Encoder\CsvEncoder::ESCAPE_CHAR_KEY = 'csv_escape_char'
 
  • deprecated since Symfony 7.2, to be removed in 8.0
public Symfony\Component\Serializer\Encoder\CsvEncoder::ESCAPE_FORMULAS_KEY = 'csv_escape_formulas'
public Symfony\Component\Serializer\Encoder\CsvEncoder::FORMAT = 'csv'
public Symfony\Component\Serializer\Encoder\CsvEncoder::HEADERS_KEY = 'csv_headers'
public Symfony\Component\Serializer\Encoder\CsvEncoder::KEY_SEPARATOR_KEY = 'csv_key_separator'
public Symfony\Component\Serializer\Encoder\CsvEncoder::NO_HEADERS_KEY = 'no_headers'
public Symfony\Component\Serializer\Encoder\CsvEncoder::OUTPUT_UTF8_BOM_KEY = 'output_utf8_bom'
Methods
public __construct(array $defaultContext = [])
public decode(string $data, string $format, array $context = []) : ?mixed
public encode(?mixed $data, string $format, array $context = []) : string
public supportsDecoding(string $format) : bool
public supportsEncoding(string $format) : bool
Constants
private Symfony\Component\Serializer\Encoder\CsvEncoder::FORMULAS_START_CHARACTERS = ['=', '-', '+', '@', ' ', ' ']
private Symfony\Component\Serializer\Encoder\CsvEncoder::UTF8_BOM = ''
Properties
private array $defaultContext = ['csv_delimiter' => ',', 'csv_enclosure' => '"', 'csv_escape_char' => '', 'csv_end_of_line' => ' ', 'csv_escape_formulas' => false, 'csv_headers' => [], 'csv_key_separator' => '.', 'no_headers' => false, 'as_collection' => true, 'output_utf8_bom' => false]
Methods
private extractHeaders(iterable $data) : array
 
  • return string[]
private flatten(iterable $array, array $result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false) : void
 

Flattens an array and generates keys including the path.

private getCsvOptions(array $context) : array
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration