src/Css/Rule/Processor.php
public function convertToObjects($media, $rule, $originalOrder)
    {
        $rule = $this->cleanup($rule);

        $chunks = explode('{', $rule);

        $selectorIdentifier = 0;
        $ruleIdentifier = 1;

        if (!isset($chunks[$ruleIdentifier])) {
            return [];
        }
        $propertiesProcessor = new PropertyProcessor();
        $rules = [];
        $selectors = (array)explode(',', trim($chunks[$selectorIdentifier]));
        $properties = $propertiesProcessor->splitIntoSeparateProperties($chunks[$ruleIdentifier]);

        foreach ($selectors as $selector) {
            $selector = trim($selector);
            $specificity = $this->calculateSpecificityBasedOnASelector($selector);

            $rules[] = new Rule(
                $media,
                $selector,
                $propertiesProcessor->convertArrayToObjects($properties, $specificity),
                $specificity,
                $originalOrder
            );
        }

        return $rules;
    }
public function convertToObjects($media, $rule, $originalOrder)
    {
        $rule = $this->cleanup($rule);

        $chunks = explode('{', $rule);

        $selectorIdentifier = 0;
        $ruleIdentifier = 1;

        if (!isset($chunks[$ruleIdentifier])) {
            return [];
        }
        $propertiesProcessor = new PropertyProcessor();
        $rules = [];
        $selectors = (array)explode(',', trim($chunks[$selectorIdentifier]));
        $properties = $propertiesProcessor->splitIntoSeparateProperties($chunks[$ruleIdentifier]);

        foreach ($selectors as $selector) {
            $selector = trim($selector);
            $specificity = $this->calculateSpecificityBasedOnASelector($selector);

            $rules[] = new Rule(
                $media,
                $selector,
                $propertiesProcessor->convertArrayToObjects($properties, $specificity),
                $specificity,
                $originalOrder
            );
        }

        return $rules;
    }
public function convertToObjects ( $ media , $ rule , $ originalOrder ) { $ rule = $ this -> cleanup ( $ rule ) ; $ chunks = explode ( '{' , $ rule ) ; $ selectorIdentifier = 0 ; $ ruleIdentifier = 1 ; if ( ! isset ( $ chunks [ $ ruleIdentifier ] ) ) { return [ ] ; } $ propertiesProcessor = new PropertyProcessor ( ) ; $ rules = [ ] ; $ selectors = ( array ) explode ( ',' , trim ( $ chunks [ $ selectorIdentifier ] ) ) ; $ properties = $ propertiesProcessor -> splitIntoSeparateProperties ( $ chunks [ $ ruleIdentifier ] ) ; foreach ( $ selectors as $ selector ) { $ selector = trim ( $ selector ) ; $ specificity = $ this -> calculateSpecificityBasedOnASelector ( $ selector ) ; $ rules [ ] = new Rule ( $ media , $ selector , $ propertiesProcessor -> convertArrayToObjects ( $ properties , $ specificity ) , $ specificity , $ originalOrder ) ; } return $ rules ; }
Convert a rule-string into an object

@param string $media
@param string $rule
@param int    $originalOrder
@return array
Convert a rule - string into an object