protected function writeExtractedComments(POString $string) { foreach ($string->getExtractedComments() as $comment) { foreach (explode("\n", $comment) as $commentLine) { $this->writeLine(sprintf('#. %s', $commentLine)); } } }
/** * Add POString instance to catalog. If identical string already exists, * reference and extracted comment attributes will be merged. */ public function add(POString $string) { $id = $string->getMsgctxt() . "" . $string->getMsgid(); $category = $string->getCategoryText(); $domain = $string->getDomain(); if (isset($this->strings[$category][$domain][$id])) { array_map(array($this->strings[$category][$domain][$id], 'addReference'), $string->getReferences()); array_map(array($this->strings[$category][$domain][$id], 'addExtractedComment'), $string->getExtractedComments()); } else { $this->strings[$category][$domain][$id] = $string; } }