File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 22
33namespace PageSpecificCss ;
44
5- use TijsVerkoyen \CssToInlineStyles \Css \Property \Property ;
6-
75class HtmlStore
86{
97 /** @var array Property objects, grouped by selector */
108 private $ snippets = [];
119
1210 public function addHtmlSnippet ($ htmlSnippet )
1311 {
14- $ this ->snippets = array_merge ($ this ->snippets , $ htmlSnippet );
12+ $ this ->snippets = array_merge ($ this ->snippets , [ $ htmlSnippet] );
1513 return $ this ;
1614 }
1715
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class PageSpecificCss extends CssToInlineStyles
2222 private $ processor ;
2323
2424 /** @var Rule[] */
25- private $ rules ;
25+ private $ rules = [] ;
2626
2727 /** @var HtmlStore */
2828 private $ htmlStore ;
@@ -50,20 +50,12 @@ public function getHtmlStore()
5050 return $ this ->htmlStore ;
5151 }
5252
53- /**
54- * @param string $html the raw html
55- */
56- public function processHtmlToStore ($ html )
57- {
58- $ this ->cssStore ->addCssStyles ($ this ->extractCss ($ html ));
59- }
60-
6153 /**
6254 * @param $sourceCss
6355 */
6456 public function addBaseRules ($ sourceCss )
6557 {
66- $ this ->rules = array_merge ( $ this ->rules , $ this -> processor ->getRules ($ sourceCss) );
58+ $ this ->rules = $ this ->processor ->getRules ($ sourceCss, $ this -> rules );
6759 }
6860
6961 public function buildExtractedRuleSet ()
@@ -75,6 +67,14 @@ public function buildExtractedRuleSet()
7567 return $ this ->cssStore ->compileStyles ();
7668 }
7769
70+ /**
71+ * @param string $html the raw html
72+ */
73+ public function processHtmlToStore ($ html )
74+ {
75+ $ this ->cssStore ->addCssStyles ($ this ->extractCss ($ html ));
76+ }
77+
7878 /**
7979 * @param $html
8080 *
You can’t perform that action at this time.
0 commit comments