@@ -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
0 commit comments