escapeChar = $escapeChar; $this->startingChars = $startingChars; } /** * @return array|string[] */ public function getStartingChars() { return $this->startingChars; } /** * @return string */ public function getEscapeChar() { return $this->escapeChar; } /** * @param string $cell * @return string */ public function escapeField($cell) { if (!is_string($cell) || empty($cell)) { return $cell; } if (in_array($cell[0], $this->startingChars, true)) { return $this->escapeChar . $cell; } return $cell; } }