jbowens / jBBCode

A lightweight but extensible BBCode parser
http://jbbcode.com
MIT License
164 stars 32 forks source link

Method chaining in Parser #18

Closed Art4 closed 10 years ago

Art4 commented 10 years ago

I've simply added the line return $this; in some Parser methods for method chaining like this:

$parser = new JBBCode\Parser();
    ->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet())
    ->addCodeDefinitionSet(new SpecialCodeDefinitionSet());

$text = "The bbcode in here [b]is never closed!";
print $parser->parse($text)->getAsBBCode();

$text = "[u]Another bbcode example![/u]";
print $parser->parse($text)->getAsHtml();

I also fixed the documentation in Parser for some methods.