InlineStyleParser
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- parse() : array<string|int, mixed>
- Parse inline CSS style attribute.
- processUrlsInCss() : string
- Process URLs in CSS strings by encoding special characters.
Properties
$normalizeProperties
private
NormalizeProperties
$normalizeProperties
Methods
__construct()
public
__construct(NormalizeProperties $normalizeProperties) : mixed
Parameters
- $normalizeProperties : NormalizeProperties
parse()
Parse inline CSS style attribute.
public
parse(string $html) : array<string|int, mixed>
Parses a CSS string from an HTML style attribute and returns an array of CSS properties.
Parameters
- $html : string
-
CSS string from style attribute
Return values
array<string|int, mixed> —Parsed CSS properties
processUrlsInCss()
Process URLs in CSS strings by encoding special characters.
public
processUrlsInCss(string $css) : string
Characters "(", ")", and ";" in url() can cause problems parsing CSS. This method URLencodes ( and ), and temporarily encodes ";" to prevent confusion with CSS segment delimiters.
Parameters
- $css : string
-
CSS string containing url() references
Return values
string —CSS string with processed URLs