コード例 #1
0
ファイル: PartTest.php プロジェクト: phpbadge/phpbadge
 public function testSetWidth()
 {
     // Arrange
     // ...
     // Act
     $this->part->setWidth('anotherWidth');
     // Assert
     $this->assertEquals('anotherWidth', $this->part->getWidth());
 }
コード例 #2
0
ファイル: SvgRenderer.php プロジェクト: phpbadge/phpbadge
 private function calculateWidth(Part $part)
 {
     $textWidth = $this->widthCalculator->getWidth($part->getText(), $part->getFont()) + 10;
     if (!$part->getWidth()) {
         $width = $textWidth;
     } else {
         $width = $part->getWidth();
     }
     return $width;
 }