kriswallsmith/assetic — pull request #416 by googoid (2013-05-14 03:14:18+00:00)
Title: Added setOptions() method to all filters

1. Created `BaseFilter` class. There is `BaseFilter::setOptions()` which will call setters for each option, this method is automatically being called from constructor. It also includes `BaseFilter::isOptionSupported()` method
2. Now all filters extend from `BaseFilter`, so all of them support `::setOptions()` and `::isOptionSupported()` methods
3. Added test for `BaseFilter` methods and option name validation

#### 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.

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