StyleClassNode.php 836 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\twig\html;
  8. class StyleClassNode extends BaseClassNode
  9. {
  10. public function __construct(\Twig_Token $name, $value, \Twig_Token $operator, $lineno = 0, $tag = null)
  11. {
  12. parent::__construct(array('value' => $value), array('name' => $name, 'operator' => $operator), $lineno, $tag);
  13. }
  14. public function getHelperMethod()
  15. {
  16. $operator = $this->getAttribute('operator')->getValue();
  17. switch ($operator) {
  18. case '+':
  19. return 'addCssStyle';
  20. case '-':
  21. return 'removeCssStyle';
  22. default:
  23. throw new \Twig_Error("Operator {$operator} no found;");
  24. }
  25. }
  26. }