-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangeLog.php
41 lines (34 loc) · 811 Bytes
/
ChangeLog.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php declare(strict_types = 1);
namespace Ilex\ChangeLog;
use Ilex\ChangeLog\Formatter\FormatterInterface;
/**
* Class ChangeLog
*
* @package Ilex\ChangeLog
*/
class ChangeLog
{
/**
* @var array<int,\Ilex\ChangeLog\Release>
*/
private array $releases = [];
/**
* ChangeLog constructor.
*/
public function __construct(private readonly string $title, private readonly string $description, private readonly FormatterInterface $formatter)
{
}
public function addRelease(Release $release): self
{
$this->releases[] = $release;
return $this;
}
public function render(): string
{
return $this->formatter->render(
$this->title,
$this->description,
$this->releases
);
}
}