14/01
2014
Parses ++ and -- messages from strings
A small library to parse ++ and -- messages. For example:, (*1)
asm89 | qbot++ qbot | current score for qbot: 1337 asm89 | [it handles spaces]++ qbot | current score for it handles spaces: 42
Run:, (*2)
composer require asm89/plusminus-parser
or add it to your composer.json
file., (*3)
Create a parser and pass it the matchers you want to use., (*4)
$parser = new Asm89\PlusMinus\MessageParser([ new Asm89\PlusMinus\WordMatcher(0), new Asm89\PlusMinus\BracketMatcher(1), // bracket items take priority ]): /** @return null|Item */ $item = $parser->parse($message); // item API $item->getValue(); $item->isMinus(); $item->isPlus();