nelmio/NelmioCorsBundle — pull request #16 by bdunogier (2013-12-16 16:12:10+00:00)
Title: Added abstract CORS configuration

This pull request makes the CORS configuration abstract and extensible.

## Detailled description
Configuration providers can be implemented based on `Cors\Configuration\ProviderInterface`, and registered as such using the `nelmio_cors.cors.configuration.provider` service tag:

```yaml
services:
my.cors_configuration_provider:
class: My\CorsConfigurationProvider
tags:
- { name: nelmio_cors.cors.configuration.provider, priority: 10 }
```

Providers must implement the `getOptionsForPath()` method, that, given a path, will return the CORS options as a hash.

## Backward compatibility
The existing, semantic, CORS configuration is implemented in a `Cors\Configuration\DefaultProvider`. It has the lowest priority, and is always loaded.

Without any custom provider, the behaviour is unchanged.

## Real-life example
ezsystems/ezpublish-kernel#663 uses a custom provider that matches the requested path against the router, and returns the registered REST routes.

It only provides the `allow_methods` options. All other options use the default semantic config, as can be seen in ezpublish-community#89.

## Testing
All submitted code should have a coverage of about 100%, and is used in the pull-requests linked above.