Behat/Behat — pull request #445 by everzet (2014-01-31 10:56:06+00:00)
Title: Refactored ContextSnippetGenerator

Pattern generation responsibility was moved to `PatternTransformer`. This allowed to heavily simplify context snippet generator by replacing `ContextTurnipSnippetGenerator` and `ContextRegexSnippetGenerator` with a single `ContextSnippetGenerator`.

Refactoring also allowed introduction of additional extension point - `PatternPolicy`, which allows extension creators to add their own patterns support to behat (in addition to bundled turnip and regex patterns).

In the userland, `TurnipAcceptingContext` was renamed to `SnippetAcceptingContext` and `RegexAcceptingContext` was removed in favour of `CustomSnippetAcceptingContext`:

```php
interface CustomSnippetAcceptingContext extends SnippetAcceptingContext
{
public static function getAcceptedSnippetType();
}
```

So in order to tell Behat to generate `regex` patterned-snippets for your context, you do something like that:

```php
class YourContext implements CustomSnippetAcceptingContext
{
public static function getAcceptedSnippetType()
{
return 'regex';
}
}
```

This is a bit more verbose setup, but it allows better and cleaner interfaces with obvious extension point for extension developers.