src/Crossjoin/Css/Format/Rule/AtMedia/MediaRule.php
protected function parseConditionList($conditionList)
    {
        $charset = $this->getCharset();

        $conditions = [];
        foreach (Condition::splitNestedConditions($conditionList) as $normalizedConditionList) {
            $normalizedConditions = [];
            $currentCondition = "";

            if (preg_match('/[^\x00-\x7f]/', $normalizedConditionList)) {
                $isAscii = false;
                $strLen  = mb_strlen($normalizedConditionList, $charset);
                $getAnd  = function($i) use ($normalizedConditionList){return strtolower(substr($normalizedConditionList, $i, 5));};
            } else {
                $isAscii = true;
                $strLen = strlen($normalizedConditionList);
                $getAnd  = function($i) use ($charset, $normalizedConditionList){return mb_strtolower(mb_substr($normalizedConditionList, $i, 5, $charset), $charset);};
            }

            for ($i = 0, $j = $strLen; $i < $j; $i++) {
                if ($isAscii === true) {
                    //$char = substr($normalizedConditionList, $i, 1);
                    $char = $normalizedConditionList[$i];
                } else {
                    $char = mb_substr($normalizedConditionList, $i, 1, $charset);
                }

                if ($char === " " && $getAnd($i) === " and ") {
                    $normalizedConditions[] = new MediaCondition(trim($currentCondition, " \r\n\t\f"));
                    $currentCondition = "";
                    $i += (5 - 1);
                } else {
                    $currentCondition .= $char;
                }
            }
            $currentCondition = trim($currentCondition, " \r\n\t\f");
            if ($currentCondition !== "") {
                $normalizedConditions[] = new MediaCondition(trim($currentCondition, " \r\n\t\f"));
            }

            foreach ($normalizedConditions as $normalizedCondition) {
                $conditions[] = $normalizedCondition;
            }
        }

        return $conditions;
    }
protected function parseConditionList($conditionList)
    {
        $charset = $this->getCharset();

        $conditions = [];
        foreach (Condition::splitNestedConditions($conditionList) as $normalizedConditionList) {
            $normalizedConditions = [];
            $currentCondition = "";

            if (preg_match('/[^\x00-\x7f]/', $normalizedConditionList)) {
                $isAscii = false;
                $strLen  = mb_strlen($normalizedConditionList, $charset);
                $getAnd  = function($i) use ($normalizedConditionList){return strtolower(substr($normalizedConditionList, $i, 5));};
            } else {
                $isAscii = true;
                $strLen = strlen($normalizedConditionList);
                $getAnd  = function($i) use ($charset, $normalizedConditionList){return mb_strtolower(mb_substr($normalizedConditionList, $i, 5, $charset), $charset);};
            }

            for ($i = 0, $j = $strLen; $i < $j; $i++) {
                if ($isAscii === true) {
                    //$char = substr($normalizedConditionList, $i, 1);
                    $char = $normalizedConditionList[$i];
                } else {
                    $char = mb_substr($normalizedConditionList, $i, 1, $charset);
                }

                if ($char === " " && $getAnd($i) === " and ") {
                    $normalizedConditions[] = new MediaCondition(trim($currentCondition, " \r\n\t\f"));
                    $currentCondition = "";
                    $i += (5 - 1);
                } else {
                    $currentCondition .= $char;
                }
            }
            $currentCondition = trim($currentCondition, " \r\n\t\f");
            if ($currentCondition !== "") {
                $normalizedConditions[] = new MediaCondition(trim($currentCondition, " \r\n\t\f"));
            }

            foreach ($normalizedConditions as $normalizedCondition) {
                $conditions[] = $normalizedCondition;
            }
        }

        return $conditions;
    }
protected function parseConditionList ( $ conditionList ) { $ charset = $ this -> getCharset ( ) ; $ conditions = [ ] ; foreach ( Condition :: splitNestedConditions ( $ conditionList ) as $ normalizedConditionList ) { $ normalizedConditions = [ ] ; $ currentCondition = "" ; if ( preg_match ( '/[^\x00-\x7f]/' , $ normalizedConditionList ) ) { $ isAscii = false ; $ strLen = mb_strlen ( $ normalizedConditionList , $ charset ) ; $ getAnd = function ( $ i ) use ( $ normalizedConditionList ) { return strtolower ( substr ( $ normalizedConditionList , $ i , 5 ) ) ; } ; } else { $ isAscii = true ; $ strLen = strlen ( $ normalizedConditionList ) ; $ getAnd = function ( $ i ) use ( $ charset , $ normalizedConditionList ) { return mb_strtolower ( mb_substr ( $ normalizedConditionList , $ i , 5 , $ charset ) , $ charset ) ; } ; } for ( $ i = 0 , $ j = $ strLen ; $ i < $ j ; $ i ++ ) { if ( $ isAscii === true ) { //$char = substr($normalizedConditionList, $i, 1); $ char = $ normalizedConditionList [ $ i ] ; } else { $ char = mb_substr ( $ normalizedConditionList , $ i , 1 , $ charset ) ; } if ( $ char === " " && $ getAnd ( $ i ) === " and " ) { $ normalizedConditions [ ] = new MediaCondition ( trim ( $ currentCondition , " \r\n\t\f" ) ) ; $ currentCondition = "" ; $ i += ( 5 - 1 ) ; } else { $ currentCondition .= $ char ; } } $ currentCondition = trim ( $ currentCondition , " \r\n\t\f" ) ; if ( $ currentCondition !== "" ) { $ normalizedConditions [ ] = new MediaCondition ( trim ( $ currentCondition , " \r\n\t\f" ) ) ; } foreach ( $ normalizedConditions as $ normalizedCondition ) { $ conditions [ ] = $ normalizedCondition ; } } return $ conditions ; }
Parses the condition part of the media rule.

@param string $conditionList
@return MediaCondition[]
Parses the condition part of the media rule .