OpenBuildings/swiftmailer-css-inliner — pull request #4 by armab (2014-05-02 13:14:05+00:00)
Title: Enhancement: More flexible bootstrap

This will allow to initialize plugin this way:

```php
new CssInlinerPlugin([
'cleanup' => true,
'useInlineStylesBlock' => true,
'stripOriginalStyleTags' => true,
]);
```

Actually I suggest it for compatibility with Yii2 framework. With this change it's possible to enable CssInlinerPlugin in this easy way in Yii2 config file:

```php
return [
'components' => [

[...]

/**
* Mailer
*
* @link https://github.com/yiisoft/yii2-swiftmailer
* @link http://swiftmailer.org/docs/messages.html
*/
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'messageConfig' => [
'charset' => 'utf-8',
],
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'mail.domain.com',
'username' => 'support@domain.com',
'password' => '...',
'plugins' => [
[
// connect CssInlinerPlugin
'class' => 'Openbuildings\Swiftmailer\CssInlinerPlugin',
// pass arguments to CssInlinerPlugin's constructor
'constructArgs' => [[
'cleanup' => true,
'useInlineStylesBlock' => true,
'stripOriginalStyleTags' => true,
]],
],
],
],
],
],
];

```

Existing implementation when CssToInlineStyles object is passed to class constructor as parameter is already perfect.

I believe this change will be good addition that will allow to use plugin in more flexible way.