partFactory = $partFactory; parent::__construct($logger, $charsetConverter, $children); $this->comment = $this->value; $this->value = ''; $this->isSpace = true; $this->canIgnoreSpacesBefore = true; $this->canIgnoreSpacesAfter = true; } protected function getValueFromParts(array $parts) : string { $partFactory = $this->partFactory; return parent::getValueFromParts(\array_map( function($p) use ($partFactory) { if ($p instanceof CommentPart) { return $partFactory->newQuotedLiteralPart([$partFactory->newToken('(' . $p->getComment() . ')')]); } elseif ($p instanceof QuotedLiteralPart) { return $partFactory->newQuotedLiteralPart([$partFactory->newToken('"' . \str_replace('(["\\])', '\$1', $p->getValue()) . '"')]); } return $p; }, $parts )); } /** * Returns the comment's text. */ public function getComment() : string { return $this->comment; } /** * Returns an empty string. */ public function getValue() : string { return ''; } }