You are here

public function CsvEncoder::__construct in CSV Serialization 8

Same name and namespace in other branches
  1. 8.2 src/Encoder/CsvEncoder.php \Drupal\csv_serialization\Encoder\CsvEncoder::__construct()

Constructs the class.

Parameters

string $delimiter: Indicates the character used to delimit fields. Defaults to ",".

string $enclosure: Indicates the character used for field enclosure. Defaults to '"'.

string $escape_char: Indicates the character used for escaping. Defaults to "\".

bool $strip_tags: Whether to strip tags from values or not. Defaults to TRUE.

bool $trim_values: Whether to trim values or not. Defaults to TRUE.

File

src/Encoder/CsvEncoder.php, line 88

Class

CsvEncoder
Adds CSV encoder support for the Serialization API.

Namespace

Drupal\csv_serialization\Encoder

Code

public function __construct($delimiter = ",", $enclosure = '"', $escape_char = "\\", $strip_tags = TRUE, $trim_values = TRUE) {
  $this->delimiter = $delimiter;
  $this->enclosure = $enclosure;
  $this->escapeChar = $escape_char;
  $this->stripTags = $strip_tags;
  $this->trimValues = $trim_values;
  if (!ini_get("auto_detect_line_endings")) {
    ini_set("auto_detect_line_endings", '1');
  }
}