Documentation

CssManager
in package

Table of Contents

Properties

$cascadeCSS  : array<string|int, mixed>
Cascading CSS property storage.
$CSS  : array<string|int, mixed>
Main CSS property storage array.
$tablecascadeCSS  : array<string|int, mixed>
CSS cascade storage for table elements.
$tbCSSlvl  : int
$cssMerger  : CssMerger
$cssParser  : CssParser

Methods

__construct()  : mixed
CssManager constructor.
getBorderDominance()  : int
Get border dominance level for a specific side.
getMaxClassDepth()  : mixed
getUsedClassNames()  : mixed
mergeCss()  : array<string|int, mixed>
Merge CSS properties for an HTML element.
previewBlockCss()  : array<string|int, mixed>
Preview block-level CSS without creating the block.
readCss()  : string
Read and parse CSS from HTML content.
readInlineCss()  : array<string|int, mixed>
Parse inline CSS style attribute.
setBorderDominance()  : void
Set border dominance level for a specific side.
setCssBoxShadow()  : array<string|int, mixed>
Parse box-shadow CSS property.
setCssTextShadow()  : array<string|int, mixed>
Parse text-shadow CSS property.

Properties

$cascadeCSS

Cascading CSS property storage.

public 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

Main CSS property storage array.

public 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', ], ... ]

$tablecascadeCSS

CSS cascade storage for table elements.

public array<string|int, mixed> $tablecascadeCSS = []

Stores cascaded CSS properties specifically for table elements (TABLE, THEAD, TBODY, TFOOT, TR, TH, TD). Format is a nested array mirroring the selector hierarchy. Example for "DIV TABLE TD": [ 'DIV' => [ 'TABLE' => [ 'TD' => [ 'BORDER' => '1px solid green', 'depth' => 3 ] ] ] ]

$tbCSSlvl

public int $tbCSSlvl = 0

Table CSS cascade level counter

Methods

__construct()

CssManager constructor.

public __construct(CssParser $cssParser, CssMerger $cssMerger) : mixed

Initializes the CSS manager with required dependencies and sets up internal storage structures for CSS properties and cascading.

Parameters
$cssParser : CssParser
$cssMerger : CssMerger

getBorderDominance()

Get border dominance level for a specific side.

public getBorderDominance(string $side) : int
Parameters
$side : string

T|R|B|L

Return values
int

Dominance value

getMaxClassDepth()

public getMaxClassDepth() : mixed

getUsedClassNames()

public getUsedClassNames() : mixed

mergeCss()

Merge CSS properties for an HTML element.

public mergeCss(string $inherit, string $tag, array<string|int, mixed> $attr) : array<string|int, mixed>

Main method for applying CSS to an element. Combines CSS from multiple sources including default styles, stylesheets, inline styles, and inherited properties. Handles inheritance type (BLOCK, INLINE, TABLE, TOPTABLE) and applies appropriate cascading rules.

Parameters
$inherit : string

Inheritance context (BLOCK, INLINE, TABLE, TOPTABLE)

$tag : string

HTML tag name

$attr : array<string|int, mixed>

HTML attributes including CLASS, ID, STYLE

Return values
array<string|int, mixed>

Merged CSS properties array

previewBlockCss()

Preview block-level CSS without creating the block.

public previewBlockCss(string $tag, array<string|int, mixed> $attr) : array<string|int, mixed>

Looks ahead to determine what CSS would be applied to a block element without actually creating it. Used for planning layout and spacing.

Parameters
$tag : string

HTML tag name

$attr : array<string|int, mixed>

HTML attributes array

Return values
array<string|int, mixed>

CSS properties that would be applied

readCss()

Read and parse CSS from HTML content.

public readCss(string $html) : string

Extracts CSS from style tags, link tags, and @import statements within HTML. Processes external stylesheets, resolves URLs, handles media queries, and parses all CSS rules into the internal CSS storage structure.

Parameters
$html : string

HTML content containing CSS

Return values
string

HTML with CSS content removed

readInlineCss()

Parse inline CSS style attribute.

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

CSS string from style attribute

Return values
array<string|int, mixed>

Parsed CSS properties

setBorderDominance()

Set border dominance level for a specific side.

public setBorderDominance(string $side, int $val) : void
Parameters
$side : string

T|R|B|L

$val : int

Dominance value

Tags
throws
InvalidArgumentException

setCssBoxShadow()

Parse box-shadow CSS property.

public setCssBoxShadow(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

setCssTextShadow()

Parse text-shadow CSS property.

public setCssTextShadow(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


        
On this page

Search results