Skip to content
This repository was archived by the owner on Mar 26, 2021. It is now read-only.

Commit ee4e779

Browse files
committed
Change visibility of method write to public
* rename method writeToFile() to write() * add method write() to interface
1 parent 66f9826 commit ee4e779

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Interfaces/WritesMarkdownFile.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
interface WritesMarkdownFile
66
{
7+
public function write( string $formatOrContents, ...$contextValues ) : void;
8+
79
public function writeLegend( array $legend ) : void;
810

911
public function writeHeadline( string $title, int $level ) : void;

src/Output/MarkdownFile.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function writeLegend( array $legend ) : void
3636
$legendStrings[] = "{$output} {$status}";
3737
}
3838

39-
$this->writeToFile( "%s\n\n", implode( ' | ', $legendStrings ) );
39+
$this->write( "%s\n\n", implode( ' | ', $legendStrings ) );
4040
}
4141

4242
/**
@@ -45,7 +45,7 @@ public function writeLegend( array $legend ) : void
4545
*
4646
* @throws RuntimeException
4747
*/
48-
private function writeToFile( string $formatOrContents, ...$contextValues ) : void
48+
public function write( string $formatOrContents, ...$contextValues ) : void
4949
{
5050
fwrite(
5151
$this->getFileHandle(),
@@ -80,7 +80,7 @@ private function getFileHandle()
8080
*/
8181
public function writeHeadline( string $title, int $level ) : void
8282
{
83-
$this->writeToFile( "%s %s\n\n", str_repeat( '#', $level ), $title );
83+
$this->write( "%s %s\n\n", str_repeat( '#', $level ), $title );
8484
}
8585

8686
/**
@@ -110,7 +110,7 @@ private function writeListing( array $elements, int $indentLevel, string $lineCh
110110

111111
$indent = str_repeat( ' ', $indentLevel * 2 );
112112

113-
$this->writeToFile(
113+
$this->write(
114114
"%s%s %s\n\n",
115115
$indent,
116116
$lineChar,
@@ -137,7 +137,7 @@ public function writeBlockQuoteListing( array $elements, int $indentLevel = 0 )
137137
*/
138138
public function writeCheckbox( string $label, bool $ticked ) : void
139139
{
140-
$this->writeToFile(
140+
$this->write(
141141
"- [%s] %s\n",
142142
$ticked ? 'x' : ' ',
143143
$label
@@ -149,7 +149,7 @@ public function writeCheckbox( string $label, bool $ticked ) : void
149149
*/
150150
public function writeHorizontalRule() : void
151151
{
152-
$this->writeToFile( "\n---\n\n" );
152+
$this->write( "\n---\n\n" );
153153
}
154154

155155
public function getFilePath() : string

0 commit comments

Comments
 (0)