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 2
2
3
3
namespace PageSpecificCss ;
4
4
5
- use TijsVerkoyen \CssToInlineStyles \Css \Property \Property ;
6
-
7
5
class HtmlStore
8
6
{
9
7
/** @var array Property objects, grouped by selector */
10
8
private $ snippets = [];
11
9
12
10
public function addHtmlSnippet ($ htmlSnippet )
13
11
{
14
- $ this ->snippets = array_merge ($ this ->snippets , $ htmlSnippet );
12
+ $ this ->snippets = array_merge ($ this ->snippets , [ $ htmlSnippet] );
15
13
return $ this ;
16
14
}
17
15
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class PageSpecificCss extends CssToInlineStyles
22
22
private $ processor ;
23
23
24
24
/** @var Rule[] */
25
- private $ rules ;
25
+ private $ rules = [] ;
26
26
27
27
/** @var HtmlStore */
28
28
private $ htmlStore ;
@@ -50,20 +50,12 @@ public function getHtmlStore()
50
50
return $ this ->htmlStore ;
51
51
}
52
52
53
- /**
54
- * @param string $html the raw html
55
- */
56
- public function processHtmlToStore ($ html )
57
- {
58
- $ this ->cssStore ->addCssStyles ($ this ->extractCss ($ html ));
59
- }
60
-
61
53
/**
62
54
* @param $sourceCss
63
55
*/
64
56
public function addBaseRules ($ sourceCss )
65
57
{
66
- $ this ->rules = array_merge ( $ this ->rules , $ this -> processor ->getRules ($ sourceCss) );
58
+ $ this ->rules = $ this ->processor ->getRules ($ sourceCss, $ this -> rules );
67
59
}
68
60
69
61
public function buildExtractedRuleSet ()
@@ -75,6 +67,14 @@ public function buildExtractedRuleSet()
75
67
return $ this ->cssStore ->compileStyles ();
76
68
}
77
69
70
+ /**
71
+ * @param string $html the raw html
72
+ */
73
+ public function processHtmlToStore ($ html )
74
+ {
75
+ $ this ->cssStore ->addCssStyles ($ this ->extractCss ($ html ));
76
+ }
77
+
78
78
/**
79
79
* @param $html
80
80
*
You can’t perform that action at this time.
0 commit comments