byMedia = []; } /** * Adds (and merge) a parsed CSS tree to the render list. * * @param array $rules The parsed tree as created by CSSParser::rules() * @param string $media Forcibly specified @media block selector. */ function add( $rules, $media = '' ) { if ( !array_key_exists( $media, $this->byMedia ) ) { $this->byMedia[$media] = []; } foreach ( $rules as $rule ) { switch ( strtolower( $rule['name'] ) ) { case '@media': if ( $media == '' ) { $this->add( $rule['rules'], "@media {$rule['text']}" ); } break; case '': $this->byMedia[$media] = array_merge( $this->byMedia[$media], $rule['rules'] ); break; } } } /** * Render the collected CSS trees into a string suitable for inclusion * in a