Skip to content

Commit 185d0b8

Browse files
Merge pull request #16 from cordoval/more-minors
Upgrade to newest version of library
2 parents a68451f + e54875b commit 185d0b8

File tree

4 files changed

+40
-16
lines changed

4 files changed

+40
-16
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ php:
66

77
install:
88
- composer install
9+
10+
script: phpunit

Converter/ToInlineStyleEmailConverter.php

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ class ToInlineStyleEmailConverter
9191
* for twig templates. This is optional. Set this param when configuring this
9292
* class as a service.
9393
*/
94-
public function __construct(ContainerInterface $container = null) {
94+
public function __construct(ContainerInterface $container = null)
95+
{
9596
$this->container = $container;
9697
$this->cssToInlineStyles = new CssToInlineStyles();
9798
}
@@ -105,7 +106,8 @@ public function __construct(ContainerInterface $container = null) {
105106
*
106107
* @param bool[optional] $on Should we enable cleanup?
107108
*/
108-
public function setCleanup($on = true) {
109+
public function setCleanup($on = true)
110+
{
109111
$this->cleanup = (bool) $on;
110112
$this->cssToInlineStyles->setCleanup($this->cleanup);
111113
}
@@ -118,7 +120,8 @@ public function setCleanup($on = true) {
118120
*
119121
* @param bool[optional] $on Should we process inline styles?
120122
*/
121-
public function setUseInlineStylesBlock($on = true) {
123+
public function setUseInlineStylesBlock($on = true)
124+
{
122125
$this->useInlineStylesBlock = (bool) $on;
123126
$this->cssToInlineStyles->setUseInlineStylesBlock($this->useInlineStylesBlock);
124127
}
@@ -131,7 +134,8 @@ public function setUseInlineStylesBlock($on = true) {
131134
*
132135
* @param bool[optional] $onShould we process inline styles?
133136
*/
134-
public function setStripOriginalStyleTags($on = true) {
137+
public function setStripOriginalStyleTags($on = true)
138+
{
135139
$this->stripOriginalStyleTags = (bool) $on;
136140
$this->cssToInlineStyles->setStripOriginalStyleTags($this->stripOriginalStyleTags);
137141
}
@@ -141,7 +145,8 @@ public function setStripOriginalStyleTags($on = true) {
141145
*
142146
* @param string $encoding The encoding to use.
143147
*/
144-
public function setEncoding($encoding) {
148+
public function setEncoding($encoding)
149+
{
145150
$this->encoding = (string) $encoding;
146151
$this->cssToInlineStyles->setEncoding($this->encoding);
147152
}
@@ -151,7 +156,8 @@ public function setEncoding($encoding) {
151156
*
152157
* @param string $css
153158
*/
154-
public function setCSS($css){
159+
public function setCSS($css)
160+
{
155161
$this->css = $css;
156162
$this->cssToInlineStyles->setCSS($this->css);
157163
}
@@ -161,7 +167,8 @@ public function setCSS($css){
161167
*
162168
* @param string $html
163169
*/
164-
public function setHTML($html){
170+
public function setHTML($html)
171+
{
165172
$this->html = $html;
166173
$this->cssToInlineStyles->setHTML($this->html);
167174
}
@@ -173,7 +180,8 @@ public function setHTML($html){
173180
* @param array[optional] $parameters the array of options to be used for template rendering. This field is optional
174181
* @throws MissingTemplatingEngineException The TwigEngine must be passed to the constructor, otherwise an exception is thrown
175182
*/
176-
public function setHTMLByView($view, array $parameters = array()){
183+
public function setHTMLByView($view, array $parameters = array())
184+
{
177185
if (!$this->container) {
178186
throw new MissingTemplatingEngineException("To use this function, a Container object must be passed to the constructor (@service_container service)");
179187
}
@@ -189,11 +197,24 @@ public function setHTMLByView($view, array $parameters = array()){
189197
* @return string the HTML ready to be sent with an inline-style
190198
* @throws MissingParamException the HTML and CSS are mandatory.
191199
*/
192-
public function generateStyledHTML($outputXHTML = false){
193-
if(is_null($this->html))throw new MissingParamException("The HTML must be set");
194-
if(!is_string($this->html))throw new MissingParamException("The HTML must be a valid string");
195-
if(!is_string($this->css))throw new MissingParamException("The CSS must be set");
196-
if(!is_string($this->css))throw new MissingParamException("The CSS must be a valid string");
200+
public function generateStyledHTML($outputXHTML = false)
201+
{
202+
if (is_null($this->html)) {
203+
throw new MissingParamException("The HTML must be set");
204+
}
205+
206+
if (!is_string($this->html)) {
207+
throw new MissingParamException("The HTML must be a valid string");
208+
}
209+
210+
if (!is_string($this->css)) {
211+
throw new MissingParamException("The CSS must be set");
212+
}
213+
214+
if (!is_string($this->css)) {
215+
throw new MissingParamException("The CSS must be a valid string");
216+
}
217+
197218
return $this->cssToInlineStyles->convert($outputXHTML);
198219
}
199220

Twig/InlineCssNode.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function compile(Twig_Compiler $compiler)
3030
} else {
3131
$css = '"' . addslashes(file_get_contents($this->getAttribute('css'))) . '"';
3232
}
33+
3334
$compiler->addDebugInfo($this)
3435
->write("ob_start();\n")
3536
->subcompile($this->getNode('body'))

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
],
1616
"require": {
1717
"php": ">=5.3.3",
18-
"tijsverkoyen/css-to-inline-styles": "~1.2"
18+
"tijsverkoyen/css-to-inline-styles": "~1.5.2"
1919
},
2020
"autoload": {
21-
"psr-4": { "RobertoTru\\ToInlineStyleEmailBundle": "" }
21+
"psr-4": { "RobertoTru\\ToInlineStyleEmailBundle\\": "" }
2222
},
2323
"extra": {
2424
"branch-alias": {
25-
"dev-master": "1.1-dev"
25+
"dev-master": "1.2-dev"
2626
}
2727
}
2828
}

0 commit comments

Comments
 (0)