Skip to content

Commit ab1272c

Browse files
Fix code quality errors
Fix PHP CODESNIFFER errors to pass travis test
1 parent b3c6f3c commit ab1272c

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/CssInlinerPlugin.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public function sendPerformed(\Swift_Events_SendEvent $evt)
6262
* Load the options
6363
* @param array $options Options array
6464
*/
65-
public function loadOptions($options){
65+
public function loadOptions($options)
66+
{
6667
if (isset($options['css-files']) && count($options['css-files']) > 0) {
6768
$this->css = '';
6869
foreach ($options['css-files'] as $file) {
@@ -80,24 +81,25 @@ public function loadOptions($options){
8081
*
8182
* @return string $message The message
8283
*/
83-
public function loadCssFilesFromLinks($message){
84+
public function loadCssFilesFromLinks($message)
85+
{
8486
$dom = new \DOMDocument();
8587
$dom->loadHTML($message);
8688
$link_tags = $dom->getElementsByTagName('link');
8789

88-
if($link_tags->length > 0){
90+
if ($link_tags->length > 0) {
8991
do {
90-
if($link_tags->item(0)->getAttribute('rel') == "stylesheet"){
92+
if ($link_tags->item(0)->getAttribute('rel') == "stylesheet") {
9193
$options['css-files'][] = $link_tags->item(0)->getAttribute('href');
9294

9395
// remove the link node
9496
$link_tags->item(0)->parentNode->removeChild($link_tags->item(0));
9597
}
96-
} while($link_tags->length > 0);
98+
} while ($link_tags->length > 0);
9799

98-
if(isset($options)){
100+
if (isset($options)) {
99101
// reload the options
100-
$this->loadOptions($options);
102+
$this->loadOptions($options);
101103
}
102104

103105
return $dom->saveHTML();

tests/CssInlinerPluginTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ class CssInlinerPluginTest extends PHPUnit_Framework_TestCase
99
protected $options;
1010

1111
protected static $stubDefinitions = array(
12-
'plain-text', 'original-html', 'original-html-with-css', 'original-html-with-link-css', 'original-html-with-links-css', 'converted-html',
13-
'converted-html-with-css', 'converted-html-with-links-css'
12+
'plain-text', 'original-html', 'original-html-with-css',
13+
'original-html-with-link-css', 'original-html-with-links-css',
14+
'converted-html', 'converted-html-with-css', 'converted-html-with-links-css'
1415
);
1516

1617
public function setUp()

tests/css/test2.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
body {
2-
background-color: red;
2+
background-color: red;
33
}

0 commit comments

Comments
 (0)