Skip to content

Commit f9a879a

Browse files
committed
Extract HtmlConverter::convert() to an interface
1 parent d19842d commit f9a879a

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
77
## [4.8.0] - 2018-09-18
88
### Added
99
- Added support for email auto-linking
10+
- Added a new interface (`HtmlConverterInterface`) for the main `HtmlConverter` class
1011
- Added additional test cases (#14)
1112

1213
### Changed

src/HtmlConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @license http://www.opensource.org/licenses/mit-license.php MIT
1616
*/
17-
class HtmlConverter
17+
class HtmlConverter implements HtmlConverterInterface
1818
{
1919
/**
2020
* @var Environment

src/HtmlConverterInterface.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace League\HTMLToMarkdown;
4+
5+
/**
6+
* Interface for an HTML-to-Markdown converter.
7+
*
8+
* @author Colin O'Dell <[email protected]>
9+
*
10+
* @link https://github.com/thephpleague/html-to-markdown/ Latest version on GitHub.
11+
*
12+
* @license http://www.opensource.org/licenses/mit-license.php MIT
13+
*/
14+
interface HtmlConverterInterface
15+
{
16+
/**
17+
* Convert the given $html to Markdown
18+
*
19+
* @param string $html
20+
*
21+
* @throws \InvalidArgumentException
22+
*
23+
* @return string The Markdown version of the html
24+
*/
25+
public function convert($html);
26+
}

0 commit comments

Comments
 (0)