Exemplo n.º 1
0
 public function testPadSamplesFromPHPDotNet()
 {
     $s = new Stringizer("Alien");
     $this->assertEquals("Alien     ", $s->padRight(" ", 10));
     $s = new Stringizer("Alien");
     $this->assertEquals("-=-=-Alien", $s->padLeft("-=", 10));
     $s = new Stringizer("Alien");
     $this->assertEquals("__Alien___", $s->padBoth("_", 10));
     $s = new Stringizer("Alien");
     $this->assertEquals("Alien_", $s->padRight("___", 6));
     $s = new Stringizer("Alien");
     $this->assertEquals("Alien", $s->padRight("*", 3));
 }
Exemplo n.º 2
0
 public function drawTextTitle($text)
 {
     $this->drawText($text);
     $v = $this->verticalBar() . " ";
     $textLength = (new Stringizer($text))->length();
     $s = new Stringizer("-");
     $s->padRight("-", $textLength)->padRight(" ", $this->numColumns - self::$wallOffset - self::$leftMargin);
     $v .= $s->getString();
     $v .= $this->verticalBar();
     echo $v . PHP_EOL;
 }