Get rid of unused argument in inlineCss

[MAILPOET-1891]
This commit is contained in:
Rostislav Wolny
2019-04-04 10:48:26 +02:00
committed by M. Shull
parent c2f5a98893
commit bc32e5f6f3
3 changed files with 7 additions and 11 deletions

View File

@ -167,7 +167,7 @@ class Renderer {
* @return DomNode * @return DomNode
*/ */
private function inlineCSSStyles($template) { private function inlineCSSStyles($template) {
return $this->CSS_inliner->inlineCSS(null, $template); return $this->CSS_inliner->inlineCSS($template);
} }
/** /**

View File

@ -32,15 +32,11 @@ use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
*/ */
class CSS { class CSS {
/*
* The core of the algorithm, takes a URL and returns the HTML found there with the CSS inlined.
* If you pass $contents then the original HTML is not downloaded and $contents is used instead.
* $url is mandatory as it is used to resolve the links to the stylesheets found in the HTML.
*/
/** /**
* @param string $contents
* @return DomNode * @return DomNode
*/ */
function inlineCSS($url, $contents = null) { function inlineCSS($contents) {
$html = pQuery::parseStr($contents); $html = pQuery::parseStr($contents);
if (!$html instanceof DomNode) { if (!$html instanceof DomNode) {

View File

@ -41,7 +41,7 @@ class CSSTest extends \MailPoetUnitTest {
$styles = 'p { color: red; }'; $styles = 'p { color: red; }';
$content = '<p>Foo</p>'; $content = '<p>Foo</p>';
$html = $this->buildHtml($styles, $content); $html = $this->buildHtml($styles, $content);
$result_html = (string)$this->css->inlineCSS(null, $html); $result_html = (string)$this->css->inlineCSS($html);
$this->assertContains('<p style="color:red">', $result_html); $this->assertContains('<p style="color:red">', $result_html);
} }
@ -49,7 +49,7 @@ class CSSTest extends \MailPoetUnitTest {
$styles = 'p { color: red; } .blue { color: blue; }'; $styles = 'p { color: red; } .blue { color: blue; }';
$content = '<p class="blue">Foo</p>'; $content = '<p class="blue">Foo</p>';
$html = $this->buildHtml($styles, $content); $html = $this->buildHtml($styles, $content);
$result_html = (string)$this->css->inlineCSS(null, $html); $result_html = (string)$this->css->inlineCSS($html);
$this->assertContains('<p class="blue" style="color:blue">', $result_html); $this->assertContains('<p class="blue" style="color:blue">', $result_html);
} }
@ -57,7 +57,7 @@ class CSSTest extends \MailPoetUnitTest {
$styles = 'p { color: red; }'; $styles = 'p { color: red; }';
$content = '<p style="color:green">Foo</p>'; $content = '<p style="color:green">Foo</p>';
$html = $this->buildHtml($styles, $content); $html = $this->buildHtml($styles, $content);
$result_html = (string)$this->css->inlineCSS(null, $html); $result_html = (string)$this->css->inlineCSS($html);
$this->assertContains('<p style="color:green">', $result_html); $this->assertContains('<p style="color:green">', $result_html);
} }
@ -65,7 +65,7 @@ class CSSTest extends \MailPoetUnitTest {
$styles = 'p { color: red !important; }'; $styles = 'p { color: red !important; }';
$content = '<p style="color:green !important">Foo</p>'; $content = '<p style="color:green !important">Foo</p>';
$html = $this->buildHtml($styles, $content); $html = $this->buildHtml($styles, $content);
$result_html = (string)$this->css->inlineCSS(null, $html); $result_html = (string)$this->css->inlineCSS($html);
$this->assertContains('<p style="color:red">', $result_html); $this->assertContains('<p style="color:red">', $result_html);
} }