Sabberworm\CSS\Parser::parseColorValue PHP Метод

parseColorValue() приватный Метод

private parseColorValue ( )
    private function parseColorValue()
    {
        $aColor = array();
        if ($this->comes('#')) {
            $this->consume('#');
            $sValue = $this->parseIdentifier(false);
            if ($this->strlen($sValue) === 3) {
                $sValue = $sValue[0] . $sValue[0] . $sValue[1] . $sValue[1] . $sValue[2] . $sValue[2];
            }
            $aColor = array('r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true), 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true), 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true));
        } else {
            $sColorMode = $this->parseIdentifier(false);
            $this->consumeWhiteSpace();
            $this->consume('(');
            $iLength = $this->strlen($sColorMode);
            for ($i = 0; $i < $iLength; ++$i) {
                $this->consumeWhiteSpace();
                $aColor[$sColorMode[$i]] = $this->parseNumericValue(true);
                $this->consumeWhiteSpace();
                if ($i < $iLength - 1) {
                    $this->consume(',');
                }
            }
            $this->consume(')');
        }
        return new Color($aColor);
    }