Skip to content

Commit

Permalink
Update BBCodeParser
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomano committed Dec 15, 2024
1 parent 51323e6 commit 57da921
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Compat/BBCodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@

class BBCodeParser
{
private static object $parser;
private static array $parsers;

public static function load(): object
public function __construct(public bool $for_print = false) {}

public static function load(bool $for_print = false): object
{
if (! isset(self::$parser)) {
self::$parser = new self();
if (! isset(self::$parsers[(int) $for_print])) {
self::$parsers[(int) $for_print] = new self($for_print);
}

return self::$parser;
return self::$parsers[(int) $for_print];
}

public function parse(
Expand Down

0 comments on commit 57da921

Please sign in to comment.