private function buildReplacements()
    {
        if ($this->csvFormat->getEscape()) {
            $this->escapeChars = [
                $this->csvFormat->getEscape(), // escape escape first so that it doesn't re-escape later on
                $this->csvFormat->getDelimiter(),
                "\n",
                "\r",
                "\t",
            ];
            if ($this->csvFormat->hasQuote() && !$this->csvFormat->useDoubleQuotes()) {
                $this->escapeChars[] = $this->csvFormat->getQuote();
            }

            $this->escapeChars = array_unique($this->escapeChars);

            $this->replaceChars = array_map(function ($char) {
                return $this->csvFormat->getEscape() . $char;
            }, $this->escapeChars);
        }

        if ($this->csvFormat->hasQuote() && $this->csvFormat->useDoubleQuotes()) {
            $this->escapeChars[] = $this->csvFormat->getQuote();
            $this->replaceChars[] = str_repeat($this->csvFormat->getQuote(), 2);
        }
    }
private function buildReplacements()
    {
        if ($this->csvFormat->getEscape()) {
            $this->escapeChars = [
                $this->csvFormat->getEscape(), // escape escape first so that it doesn't re-escape later on
                $this->csvFormat->getDelimiter(),
                "\n",
                "\r",
                "\t",
            ];
            if ($this->csvFormat->hasQuote() && !$this->csvFormat->useDoubleQuotes()) {
                $this->escapeChars[] = $this->csvFormat->getQuote();
            }

            $this->escapeChars = array_unique($this->escapeChars);

            $this->replaceChars = array_map(function ($char) {
                return $this->csvFormat->getEscape() . $char;
            }, $this->escapeChars);
        }

        if ($this->csvFormat->hasQuote() && $this->csvFormat->useDoubleQuotes()) {
            $this->escapeChars[] = $this->csvFormat->getQuote();
            $this->replaceChars[] = str_repeat($this->csvFormat->getQuote(), 2);
        }
    }
private function buildReplacements ( ) { if ( $ this -> csvFormat -> getEscape ( ) ) { $ this -> escapeChars = [ $ this -> csvFormat -> getEscape ( ) , // escape escape first so that it doesn't re-escape later on $ this -> csvFormat -> getDelimiter ( ) , "\n" , "\r" , "\t" , ] ; if ( $ this -> csvFormat -> hasQuote ( ) && ! $ this -> csvFormat -> useDoubleQuotes ( ) ) { $ this -> escapeChars [ ] = $ this -> csvFormat -> getQuote ( ) ; } $ this -> escapeChars = array_unique ( $ this -> escapeChars ) ; $ this -> replaceChars = array_map ( function ( $ char ) { return $ this -> csvFormat -> getEscape ( ) . $ char ; } , $ this -> escapeChars ) ; } if ( $ this -> csvFormat -> hasQuote ( ) && $ this -> csvFormat -> useDoubleQuotes ( ) ) { $ this -> escapeChars [ ] = $ this -> csvFormat -> getQuote ( ) ; $ this -> replaceChars [ ] = str_repeat ( $ this -> csvFormat -> getQuote ( ) , 2 ) ; } }
Build replacements to perform for each entry
Build replacements to perform for each entry