Skip to content

Commit 7f16da4

Browse files
author
Raphael Schweikert
committed
added example
1 parent 9ce7801 commit 7f16da4

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,65 @@ To output the entire CSS document into a variable, just use `->__toString()`:
110110
$oCssDocument = $oCssParser->parse();
111111
print $oCssDocument->__toString();
112112

113+
## Examples
114+
115+
### Parsed structure
116+
117+
#### Input
118+
119+
html, body {
120+
font-size: 1.6em
121+
}
122+
123+
#### Structure (var_dump flavoured)
124+
125+
object(CSSDocument)#2 (1) {
126+
["aContents":"CSSList":private]=>
127+
array(1) {
128+
[0]=>
129+
object(CSSSelector)#3 (2) {
130+
["aSelector":"CSSSelector":private]=>
131+
array(2) {
132+
[0]=>
133+
string(4) "html"
134+
[1]=>
135+
string(4) "body"
136+
}
137+
["aRules":"CSSRuleSet":private]=>
138+
array(1) {
139+
["font-size"]=>
140+
object(CSSRule)#4 (3) {
141+
["sRule":"CSSRule":private]=>
142+
string(9) "font-size"
143+
["aValues":"CSSRule":private]=>
144+
array(1) {
145+
[0]=>
146+
array(1) {
147+
[0]=>
148+
object(CSSSize)#5 (2) {
149+
["fSize":"CSSSize":private]=>
150+
float(1.6)
151+
["sUnit":"CSSSize":private]=>
152+
string(2) "em"
153+
}
154+
}
155+
}
156+
["bIsImportant":"CSSRule":private]=>
157+
bool(false)
158+
}
159+
}
160+
}
161+
}
162+
}
163+
164+
#### `__toString()` output
165+
166+
html, body {font-size: 1.6em;}
167+
168+
113169
## To-Do
114170

115-
* More convenience methods [like selectorsWithElement($sId/Class/TagName), removeSelector($oSelector), attributesOfType($sType), removeAttributesOfType($sType)]
171+
* More convenience methods [like `selectorsWithElement($sId/Class/TagName)`, `removeSelector($oSelector)`, `attributesOfType($sType)`, `removeAttributesOfType($sType)`]
116172
* Options for output (compact, verbose, etc.)
117173
* Support for @namespace
118174
* Test suite

0 commit comments

Comments
 (0)