Esempio n. 1
0
 /**
  * 指定された文字列をインデントして追記します.
  * @param string $contents
  */
 private function append($contents)
 {
     $result = $this->indent->indent() . $contents . $this->indent->breakCode();
     if ($this->echoMode) {
         echo $result;
     }
     $this->result .= $result;
 }
Esempio n. 2
0
 /**
  * indent() のテストです. 以下を確認します.
  * 
  * - unit に指定された文字列を, 現在の level の回数だけ繰り返した文字列を返すこと
  * - 現在の level が 0 以下の場合は空文字列を返すこと
  * 
  * @covers Peach\Markup\Indent::indent
  * @covers Peach\Markup\Indent::handleIndent
  */
 public function testIndent()
 {
     $i1 = new Indent(3, "  ");
     $this->assertSame("      ", $i1->indent());
     $i2 = new Indent(0, "  ");
     $this->assertSame("", $i2->indent());
     $i3 = new Indent(-3, "  ");
     $this->assertSame("", $i3->indent());
 }