Source of file SassMediaNode.php
Size: 1,959 Bytes - Last Modified: 2021-12-23T10:32:55+00:00
/var/www/docs.ssmods.com/process/src/code/phpsass/tree/SassMediaNode.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <?php /* SVN FILE: $Id: SassMediaNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */ /** * SassMediaNode class file. * @author Richard Lyon * @copyright none * @license http://phamlp.googlecode.com/files/license.txt * @package PHamlP * @subpackage Sass.tree */ /** * SassMediaNode class. * Represents a CSS @media directive * @package PHamlP * @subpackage Sass.tree */ class SassMediaNode extends SassNode { const IDENTIFIER = '@'; const MATCH = '/^@(media)\s+(.+?)\s*;?$/'; const MEDIA = 1; public $token; /** * @var string */ private $media; /** * @var array parameters for the message; * only used by internal warning messages */ private $params; /** * @var boolean true if this is a warning */ private $warning; /** * SassMediaNode. * @param object source token * @param mixed string: an internally generated warning message about the * source * boolean: the source token is a @Media or @warn directive containing the * message; True if this is a @warn directive * @param array parameters for the message * @return SassMediaNode */ public function __construct($token) { parent::__construct($token); preg_match(self::MATCH, $token->source, $matches); $this->token = $token; $this->media = $matches[self::MEDIA]; } /** * Parse this node. * This raises an error. * @return array An empty array */ public function parse($context) { $node = new SassRuleNode($this->token, $context); $node->root = $this->parent->root; $rule = clone $this->parent; $rule->root = $node->root; $rule->children = $this->children; $try = $rule->parse($context); if (is_array($try)) { $rule->children = $try; } else if (is_object($try) && method_exists($try, 'render')) { $rule = $try; } $node->children = array(new SassString($rule->render())); return array($node); } } |