kriswallsmith/assetic — pull request #415 by googoid (2013-05-13 22:03:06+00:00)
Title: Read the description, thanks

1. Created `BaseFilter` class. There is `BaseFilter::setOptions()` which will call setters for each option, this method is automatically being called from constructor

2. Now all filters extend from `BaseFilter`, so all filter options must be converted to key-value paired array
3. Added test for `BaseFilter` methods and option name validation
4. Corrected all tests to pass single key-value paired array to filter constructor

### WARNING
This commit will make the whole project **INCOMPATIBLE** with current version!!!

Note: it is *possible* to preserve *back-compatibility* with current version. To achieve that:
1. `FilterInterface::__construct()` must be removed
2. All modifications of `*Filter` classes must be rolled back
3. All `*Filter` classes must extend from `BaseFilter`
4. All tests must be rolled back
5. In `BaseFilterTest` the test of constructor must be removed

But I think it is more **consistent** to force all filters to have same constructor (maybe this should be postponed for new version).

#### Purpose of This Commit
https://github.com/widmogrod/zf2-assetic-module
As you know this project is using Assetic.

Currently the configuration file of AsseticModule looks like the following:
``` php
array(
'modules' => array(
/*
* Application moodule - assets configuration
*/
'application' => array(
'root_path' => __DIR__ . '/../assets',

'collections' => array(
'base_css' => array(
'assets' => array(
'css/bootstrap-responsive.min.css',
'css/style.css',
'css/bootstrap.min.css',
),
'filters' => array(
'CssRewriteFilter' => array(
'name' => 'Assetic\Filter\LessFilter',
/* attention ==> */ 'option' => array(
'/usr/bin/node', // first argument of constructor
array('/usr/local/lib/node_modules'), // second argument
),
),
),
'options' => array(),
),
),
),
),
),
);
```

In my opinion it will seem more *natively-integrated*, if it will look like this:
``` php
array(
'CssRewriteFilter' => array(
'name' => 'Assetic\Filter\LessFilter',
'options' => array(
'node_bin' => '/usr/bin/node',
'node_path' => array('/usr/local/lib/node_modules'),
),
),
),
);
```

I think you will agree, this looks more *friendly* and more *self-descriptive*

To achieve this all filters must have at least `::setOptions()` method.

#### BIG TODO
README.md must be updated according to this commit