/** * {@inheritdoc} */ public function write(Phrase $phrase) { $fields = [$phrase->getPhrase(), $phrase->getTranslation()]; $encloseQuote = $phrase->getQuote() == Phrase::QUOTE_DOUBLE ? Phrase::QUOTE_DOUBLE : Phrase::QUOTE_SINGLE; $fields[0] = $this->compileString($fields[0], $encloseQuote); $fields[1] = $this->compileString($fields[1], $encloseQuote); if (($contextType = $phrase->getContextType()) && ($contextValue = $phrase->getContextValueAsString())) { $fields[] = $contextType; $fields[] = $contextValue; } fputcsv($this->_fileHandler, $fields, ',', '"'); }