Documentation

CssParser
in package

Table of Contents

Properties

$cascadeCSS  : array<string|int, mixed>
CSS for cascaded selectors.
$commentParser  : CommentParser
$css  : array<string|int, mixed>
CSS for simple selectors.
$cssLoader  : CssLoader
$inlineStyleParser  : InlineStyleParser
$maxClassDepth  : int
$mediaQueryProcessor  : MediaQueryProcessor
$mpdf  : Mpdf
$normalizeProperties  : NormalizeProperties
$selectorParser  : SelectorParser
$shadowParser  : ShadowParser
$usedClassNames  : array<string|int, mixed>

Methods

__construct()  : mixed
getCascadeCss()  : array<string|int, mixed>
getCss()  : array<string|int, mixed>
getMaxClassDepth()  : int
getUsedClassNames()  : array<string|int, mixed>
parse()  : string
Read and parse CSS from HTML content.
parseBoxShadow()  : array<string|int, mixed>
Parse box-shadow CSS property.
parseCssProperties()  : array<string|int, mixed>
Parse CSS property string into an array.
parseInlineCss()  : array<string|int, mixed>
Parse inline CSS style attribute.
parseTextShadow()  : array<string|int, mixed>
Parse text-shadow CSS property.
processCssSelector()  : void
Process a CSS selector.
processCssString()  : void

Properties

$cascadeCSS

CSS for cascaded selectors.

private array<string|int, mixed> $cascadeCSS = []

Stores CSS properties for nested/cascaded selectors (depth > 1). Format is a nested array mirroring the selector hierarchy. Example for "DIV.myclass P": [ 'DIV' => [ 'CLASS>>MYCLASS' => [ 'P' => [ 'COLOR' => '#0000FF', 'depth' => 3 ] ] ] ]

$css

CSS for simple selectors.

private array<string|int, mixed> $css = []

Stores CSS properties for simple selectors (depth 1). Format: [ 'P' => [ 'COLOR' => '#FF0000', 'FONT-SIZE' => '12pt', ], 'CLASS>>MYCLASS' => [ 'BORDER' => '1px solid black', ], ... ]

$maxClassDepth

private int $maxClassDepth = 1

Maximum number of classes found in a single selector

$usedClassNames

private array<string|int, mixed> $usedClassNames = []

An index used to filter redundant class names before passing to Arrays::allUniqueSortedCombinations

Methods

getCascadeCss()

public getCascadeCss() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCss()

public getCss() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMaxClassDepth()

public getMaxClassDepth() : int
Return values
int

getUsedClassNames()

public getUsedClassNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

parse()

Read and parse CSS from HTML content.

public parse(string $html) : string
Parameters
$html : string

HTML content containing CSS

Return values
string

parseBoxShadow()

Parse box-shadow CSS property.

public parseBoxShadow(string $value) : array<string|int, mixed>

Converts box-shadow CSS property string into array format used internally. Handles multiple shadows, inset shadows, blur, spread, and colors.

Parameters
$value : string

Box-shadow property value

Return values
array<string|int, mixed>

Array of shadow definitions

parseCssProperties()

Parse CSS property string into an array.

public parseCssProperties(string $rawStyles) : array<string|int, mixed>
Parameters
$rawStyles : string

CSS style string (e.g. "color: red; font-size: 12px")

Return values
array<string|int, mixed>

Associative array of CSS properties

parseInlineCss()

Parse inline CSS style attribute.

public parseInlineCss(string $html) : array<string|int, mixed>
Parameters
$html : string

CSS string from style attribute

Return values
array<string|int, mixed>

Parsed CSS properties

parseTextShadow()

Parse text-shadow CSS property.

public parseTextShadow(string $value) : array<string|int, mixed>

Converts text-shadow CSS property string into array format used internally. Handles multiple shadows, blur, and colors.

Parameters
$value : string

Text-shadow property value

Return values
array<string|int, mixed>

Array of text shadow definitions

processCssSelector()

Process a CSS selector.

private processCssSelector(string $selector, array<string|int, mixed> $classProperties) : void
Parameters
$selector : string

Selector string

$classProperties : array<string|int, mixed>

CSS properties

processCssString()

private processCssString(string $css) : void
Parameters
$css : string

        
On this page

Search results