SassExtendNode.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /* SVN FILE: $Id: SassExtendNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
  3. /**
  4. * SassExtendNode class file.
  5. * @author Chris Yates <chris.l.yates@gmail.com>
  6. * @copyright Copyright (c) 2010 PBM Web Development
  7. * @license http://phamlp.googlecode.com/files/license.txt
  8. * @package PHamlP
  9. * @subpackage Sass.tree
  10. */
  11. /**
  12. * SassExtendNode class.
  13. * Represents a Sass @debug or @warn directive.
  14. * @package PHamlP
  15. * @subpackage Sass.tree
  16. */
  17. class SassExtendNode extends SassNode {
  18. const IDENTIFIER = '@';
  19. const MATCH = '/^@extend\s+(.+)/i';
  20. const VALUE = 1;
  21. /**
  22. * @var string the directive
  23. */
  24. private $value;
  25. /**
  26. * SassExtendNode.
  27. * @param object source token
  28. * @return SassExtendNode
  29. */
  30. public function __construct($token) {
  31. parent::__construct($token);
  32. preg_match(self::MATCH, $token->source, $matches);
  33. $this->value = $matches[self::VALUE];
  34. }
  35. /**
  36. * Parse this node.
  37. * @return array An empty array
  38. */
  39. public function parse($context) {
  40. $this->root->extend($this->value, $this->parent->selectors);
  41. return array();
  42. }
  43. }