| 1 | <?php |
||
| 5 | class LinkFormatter implements FormatterInterface |
||
| 6 | { |
||
| 7 | const HTML = '/ <a (?:.*?) href=[\'"](.+)[\'"] (?:.*)> (.+?) <\/a> /x'; |
||
| 8 | const MARKDOWN = '/\[(.*?)\]\((.+?)\)/'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param string $text |
||
| 12 | * |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | 3 | public function format($text) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param int $linkIdx The index of the matches containing the resource link |
||
| 25 | * @param int $labelIdx The index of the matches containing the label (if one exists) |
||
| 26 | * |
||
| 27 | * @return \Closure A callable to be passed to preg_replace_callback |
||
| 28 | */ |
||
| 29 | protected function getMatchFormatter($linkIdx = 1, $labelIdx = 2) |
||
| 42 | } |
||
| 43 |