WordPress at a glance
function is not described

Pelago\Emogrifier\HtmlProcessor

CssToAttributeConverter::parseCssDeclarationsBlock() private WC 1.0

Parses a CSS declaration block into property name/value pairs.

Example:

The declaration block

"color: #000; font-weight: bold;"

will be parsed into the following array:

"color" => "#000" "font-weight" => "bold"

{} It's a method of the class: CssToAttributeConverter{}

No Hooks.

Return

String[] . the CSS declarations with the property names as array keys and the property values as array values

Usage

// private - for code of main (parent) class only
$result = $this->parseCssDeclarationsBlock( $cssDeclarationsBlock );
$cssDeclarationsBlock(string) (required)
the CSS declarations block without the curly braces, may be empty

Code of CssToAttributeConverter::parseCssDeclarationsBlock() WC 5.4.1

<?php
private function parseCssDeclarationsBlock($cssDeclarationsBlock)
{
    if (isset(self::$parsedCssCache[$cssDeclarationsBlock])) {
        return self::$parsedCssCache[$cssDeclarationsBlock];
    }

    $properties = [];
    foreach (\preg_split('/;(?!base64|charset)/', $cssDeclarationsBlock) as $declaration) {
        $matches = [];
        if (!\preg_match('/^([A-Za-z\\-]+)\\s*:\\s*(.+)$/s', \trim($declaration), $matches)) {
            continue;
        }

        $propertyName = \strtolower($matches[1]);
        $propertyValue = $matches[2];
        $properties[$propertyName] = $propertyValue;
    }
    self::$parsedCssCache[$cssDeclarationsBlock] = $properties;

    return $properties;
}