coduo/php-matcher — pull request #27 by norzechowicz (2014-09-10 13:29:41+00:00)
Title: Initial draft of expander mechanism with StartsWith expander example

**This is still only a draft, its not ready to merge but I need to look at it from PR perspective ;)**

This implementation allows us to create multiple expanders for type patterns.
Each expander can be created with unlimited amount of arguments.
Earch argument must be a valid:
- string: "this is valid string", 'this is also valid string'
- number: integers, floats
- arrays: not supported yet

There is only one available expander atm.
- StartsWith($stringBeginning)

Example expander usage:

```php
$factory = new SimpleFactory();
$matcher = $factory->createMatcher();
$matcher->match("lorem ipsum", "@string@.startsWith('lorem')");
```

Syntax error in pattern expander will throw exception, example:

```php
$factory = new SimpleFactory();
$matcher = $factory->createMatcher();
$matcher->match("lorem ipsum", "@type@.expander('string',not_argument");
// Exception message: [Syntax Error] line 0, col 25: Error: Expected "string or number argument", got "not_argument"
```

Pattern syntax:

```
@type@.expander(args).expander(args).expander()
```

You can use as many expanders as you need. You can also create expanders without arguments.