| 1 | <?php |
||
| 21 | class RegexMatcher implements MatcherInterface |
||
| 22 | { |
||
| 23 | private $regex; |
||
| 24 | private $groups; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * RegexMatcher constructor. |
||
| 28 | * |
||
| 29 | * @param $regex |
||
| 30 | * @param array|null $groups |
||
| 31 | */ |
||
| 32 | 7 | public function __construct($regex, array $groups = [1 => null]) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Matches all occurrences and returns token list |
||
| 40 | * |
||
| 41 | * @param string $source Source to match tokens |
||
| 42 | * |
||
| 43 | * @param TokenFactoryInterface $factory |
||
| 44 | * |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | 7 | public function match($source, TokenFactoryInterface $factory) |
|
| 72 | } |