protected function compileMediaQuery($queryList)
    {
        $out = '@media';
        $first = true;

        foreach ($queryList as $query) {
            $type = null;
            $parts = [];

            foreach ($query as $q) {
                switch ($q[0]) {
                    case Type::T_MEDIA_TYPE:
                        if ($type) {
                            $type = $this->mergeMediaTypes(
                                $type,
                                array_map([$this, 'compileValue'], array_slice($q, 1))
                            );

                            if (empty($type)) { // merge failed
                                return null;
                            }
                        } else {
                            $type = array_map([$this, 'compileValue'], array_slice($q, 1));
                        }
                        break;

                    case Type::T_MEDIA_EXPRESSION:
                        if (isset($q[2])) {
                            $parts[] = '('
                                . $this->compileValue($q[1])
                                . $this->formatter->assignSeparator
                                . $this->compileValue($q[2])
                                . ')';
                        } else {
                            $parts[] = '('
                                . $this->compileValue($q[1])
                                . ')';
                        }
                        break;

                    case Type::T_MEDIA_VALUE:
                        $parts[] = $this->compileValue($q[1]);
                        break;
                }
            }

            if ($type) {
                array_unshift($parts, implode(' ', array_filter($type)));
            }

            if (! empty($parts)) {
                if ($first) {
                    $first = false;
                    $out .= ' ';
                } else {
                    $out .= $this->formatter->tagSeparator;
                }

                $out .= implode(' and ', $parts);
            }
        }

        return $out;
    }
protected function compileMediaQuery($queryList)
    {
        $out = '@media';
        $first = true;

        foreach ($queryList as $query) {
            $type = null;
            $parts = [];

            foreach ($query as $q) {
                switch ($q[0]) {
                    case Type::T_MEDIA_TYPE:
                        if ($type) {
                            $type = $this->mergeMediaTypes(
                                $type,
                                array_map([$this, 'compileValue'], array_slice($q, 1))
                            );

                            if (empty($type)) { // merge failed
                                return null;
                            }
                        } else {
                            $type = array_map([$this, 'compileValue'], array_slice($q, 1));
                        }
                        break;

                    case Type::T_MEDIA_EXPRESSION:
                        if (isset($q[2])) {
                            $parts[] = '('
                                . $this->compileValue($q[1])
                                . $this->formatter->assignSeparator
                                . $this->compileValue($q[2])
                                . ')';
                        } else {
                            $parts[] = '('
                                . $this->compileValue($q[1])
                                . ')';
                        }
                        break;

                    case Type::T_MEDIA_VALUE:
                        $parts[] = $this->compileValue($q[1]);
                        break;
                }
            }

            if ($type) {
                array_unshift($parts, implode(' ', array_filter($type)));
            }

            if (! empty($parts)) {
                if ($first) {
                    $first = false;
                    $out .= ' ';
                } else {
                    $out .= $this->formatter->tagSeparator;
                }

                $out .= implode(' and ', $parts);
            }
        }

        return $out;
    }
protected function compileMediaQuery ( $ queryList ) { $ out = '@media' ; $ first = true ; foreach ( $ queryList as $ query ) { $ type = null ; $ parts = [ ] ; foreach ( $ query as $ q ) { switch ( $ q [ 0 ] ) { case Type :: T_MEDIA_TYPE : if ( $ type ) { $ type = $ this -> mergeMediaTypes ( $ type , array_map ( [ $ this , 'compileValue' ] , array_slice ( $ q , 1 ) ) ) ; if ( empty ( $ type ) ) { // merge failed return null ; } } else { $ type = array_map ( [ $ this , 'compileValue' ] , array_slice ( $ q , 1 ) ) ; } break ; case Type :: T_MEDIA_EXPRESSION : if ( isset ( $ q [ 2 ] ) ) { $ parts [ ] = '(' . $ this -> compileValue ( $ q [ 1 ] ) . $ this -> formatter -> assignSeparator . $ this -> compileValue ( $ q [ 2 ] ) . ')' ; } else { $ parts [ ] = '(' . $ this -> compileValue ( $ q [ 1 ] ) . ')' ; } break ; case Type :: T_MEDIA_VALUE : $ parts [ ] = $ this -> compileValue ( $ q [ 1 ] ) ; break ; } } if ( $ type ) { array_unshift ( $ parts , implode ( ' ' , array_filter ( $ type ) ) ) ; } if ( ! empty ( $ parts ) ) { if ( $ first ) { $ first = false ; $ out .= ' ' ; } else { $ out .= $ this -> formatter -> tagSeparator ; } $ out .= implode ( ' and ' , $ parts ) ; } } return $ out ; }
Compile media query

@param array $queryList

@return string
Compile media query