Skip to content

Commit 0df3ae9

Browse files
committed
Use file_get_contents
1 parent e776be8 commit 0df3ae9

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/Changelog.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,45 @@
33
namespace BlameButton\Laravel\Changelog;
44

55
use BlameButton\Laravel\Changelog\Exceptions\ChangelogNotFoundException;
6-
use Illuminate\Support\Facades\Storage;
6+
use Illuminate\Mail\Markdown;
7+
use Illuminate\Support\HtmlString;
78

89
class Changelog
910
{
11+
/**
12+
* Get the location of the changelog file.
13+
*
14+
* @return string
15+
*/
1016
private function getFile(): string
1117
{
1218
return config('changelog.file', base_path('CHANGELOG.md'));
1319
}
1420

21+
/**
22+
* Get the raw content of the changelog.
23+
*
24+
* @return string
25+
* @throws ChangelogNotFoundException when the changelog file can not be found.
26+
*/
1527
public function raw(): string
1628
{
1729
$file = $this->getFile();
1830

19-
if (! Storage::exists($file)) {
31+
if (!file_exists($file)) {
2032
throw new ChangelogNotFoundException();
2133
}
2234

23-
return Storage::get($file);
35+
return file_get_contents($file);
36+
}
37+
38+
/**
39+
* Generate a HTML version of your changelog.
40+
*
41+
* @return HtmlString
42+
*/
43+
public function html(): HtmlString
44+
{
45+
return Markdown::parse($this->raw());
2446
}
2547
}

0 commit comments

Comments
 (0)