コード例 #1
0
 public function testAddAutoCommentArgs()
 {
     $summary = new Summary('summarytest');
     $summary->addAutoCommentArgs("one");
     $summary->addAutoCommentArgs(2, new ItemId('Q3'));
     $summary->addAutoCommentArgs(array("four", "five"));
     $expected = array('one', 2, new ItemId('Q3'), 'four', 'five');
     $this->assertEquals($expected, $summary->getCommentArgs());
 }
コード例 #2
0
 /**
  * Format the autocomment part of a full summary. Note that the first argument is always the
  * number of summary arguments supplied via addAutoSummaryArgs() (or the constructor),
  * and the second one is always the language code supplied via setLanguage()
  * (or the constructor).
  *
  * @since 0.5
  *
  * @param Summary $summary
  *
  * @return string with a formatted comment, or possibly an empty string
  */
 public function formatAutoComment(Summary $summary)
 {
     $composite = $summary->getMessageKey();
     $summaryArgCount = count($summary->getAutoSummaryArgs());
     $commentArgs = array_merge(array($summaryArgCount, $summary->getLanguageCode()), $summary->getCommentArgs());
     //XXX: we might want to use different formatters for autocomment and summary.
     $parts = $this->formatArgList($commentArgs);
     $joinedParts = implode('|', $parts);
     if ($joinedParts !== '') {
         $composite .= ':' . $joinedParts;
     }
     return $composite;
 }