CssToInlineStyles
in package
Table of Contents
- $cssConverter : mixed
- __construct() : mixed
- convert() : string
- Will inline the $css into the given $html
- getInlineStyles() : array<string|int, Property>
- Get the current inline styles for a given DOMElement
- inlineCssOnElement() : DOMElement
- Inline the given properties on an given DOMElement
- createDomDocumentFromHtml() : DOMDocument
- getHtmlFromDocument() : string
- inline() : DOMDocument
- calculatePropertiesToBeApplied() : array<string|int, Property>
- Merge the CSS rules to determine the applied properties.
Properties
$cssConverter
private
mixed
$cssConverter
Methods
__construct()
public
__construct() : mixed
Return values
mixed —convert()
Will inline the $css into the given $html
public
convert(string $html[, string $css = null ]) : string
Remark: if the html contains <style>-tags those will be used, the rules in $css will be appended.
Parameters
- $html : string
- $css : string = null
Return values
string —getInlineStyles()
Get the current inline styles for a given DOMElement
public
getInlineStyles(DOMElement $element) : array<string|int, Property>
Parameters
- $element : DOMElement
Return values
array<string|int, Property> —inlineCssOnElement()
Inline the given properties on an given DOMElement
public
inlineCssOnElement(DOMElement $element, array<string|int, Property> $properties) : DOMElement
Parameters
- $element : DOMElement
- $properties : array<string|int, Property>
Return values
DOMElement —createDomDocumentFromHtml()
protected
createDomDocumentFromHtml(string $html) : DOMDocument
Parameters
- $html : string
Return values
DOMDocument —getHtmlFromDocument()
protected
getHtmlFromDocument(DOMDocument $document) : string
Parameters
- $document : DOMDocument
Return values
string —inline()
protected
inline(DOMDocument $document, array<string|int, Rule> $rules) : DOMDocument
Parameters
- $document : DOMDocument
- $rules : array<string|int, Rule>
Return values
DOMDocument —calculatePropertiesToBeApplied()
Merge the CSS rules to determine the applied properties.
private
calculatePropertiesToBeApplied(array<string|int, Property> $properties, array<string|int, Property> $cssProperties) : array<string|int, Property>
Parameters
- $properties : array<string|int, Property>
- $cssProperties : array<string|int, Property>
-
existing applied properties indexed by name
Return values
array<string|int, Property> —updated properties, indexed by name