Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/BBCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ final class BBCode

const CASE_SENSITIVE = 0;

public function __construct()
public function __construct($htmlParsers = null, $bbCodeParsers = null)
{
$this->htmlParser = new HTMLParser();
$this->bbCodeParser = new BBCodeParser();
$this->htmlParser = new HTMLParser($htmlParsers);
$this->bbCodeParser = new BBCodeParser($bbCodeParsers);
}

public function only($only = null)
Expand Down
5 changes: 5 additions & 0 deletions src/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class Parser

protected $parsers = [];

public function __construct($parsers = null)
{
$this->parsers = $parsers === null ? $this->parsers : $parsers;
}

protected function searchAndReplace(string $pattern, string $replace, string $source): string
{
while (preg_match($pattern, $source)) {
Expand Down