| @@ 10-34 (lines=25) @@ | ||
| 7 | use Damianopetrungaro\PHPCommitizen\Configuration; | |
| 8 | use function wordwrap; | |
| 9 | ||
| 10 | class Body | |
| 11 | { | |
| 12 | /** | |
| 13 | * @var string | |
| 14 | */ | |
| 15 | private $body; | |
| 16 | ||
| 17 | private function __construct(string $body) | |
| 18 |     { | |
| 19 | $this->body = $body; | |
| 20 | } | |
| 21 | ||
| 22 | public static function build(string $body, Configuration $configuration): self | |
| 23 |     { | |
| 24 | $body = trim($body); | |
| 25 | $body = wordwrap($body, $configuration->wrapWidthBody(), PHP_EOL, true); | |
| 26 | ||
| 27 | return new self($body); | |
| 28 | } | |
| 29 | ||
| 30 | public function __toString(): string | |
| 31 |     { | |
| 32 | return $this->body; | |
| 33 | } | |
| 34 | } | |
| @@ 10-34 (lines=25) @@ | ||
| 7 | use Damianopetrungaro\PHPCommitizen\Configuration; | |
| 8 | use function wordwrap; | |
| 9 | ||
| 10 | class Footer | |
| 11 | { | |
| 12 | /** | |
| 13 | * @var string | |
| 14 | */ | |
| 15 | private $footer; | |
| 16 | ||
| 17 | private function __construct(string $footer) | |
| 18 |     { | |
| 19 | $this->footer = $footer; | |
| 20 | } | |
| 21 | ||
| 22 | public static function build(string $footer, Configuration $configuration): self | |
| 23 |     { | |
| 24 | $footer = trim($footer); | |
| 25 | $footer = wordwrap($footer, $configuration->wrapWidthFooter(), PHP_EOL, true); | |
| 26 | ||
| 27 | return new self($footer); | |
| 28 | } | |
| 29 | ||
| 30 | public function __toString(): string | |
| 31 |     { | |
| 32 | return $this->footer; | |
| 33 | } | |
| 34 | } | |