. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Report; use function str_contains; abstract class ReportBaseText extends ReportBaseElement { // Remaining width of a cell (points) public float $wrapWidthRemaining; // Original width of a cell (points) public float $wrapWidthCell; public function __construct( protected string $styleName, protected string $color, ) { $this->text = ''; $this->wrapWidthRemaining = 0.0; } public function setWrapWidth(float $wrapwidth, float $cellwidth): float { $this->wrapWidthCell = $cellwidth; if (str_contains($this->text, "\n")) { $this->wrapWidthRemaining = $cellwidth; } else { $this->wrapWidthRemaining = $wrapwidth; } return $this->wrapWidthRemaining; } public function getStyleName(): string { return $this->styleName; } }