Alg_TerminalExpression

The Booster for WooCommerce Alg TerminalExpression class.

Defined (1)

The class is defined in the following location(s).

/includes/lib/PHPMathParser/TerminalExpression.php  
  1. abstract class Alg_TerminalExpression { 
  2.  
  3. protected $value = ''; 
  4.  
  5. public function __construct($value) { 
  6. $this->value = $value; 
  7.  
  8. public static function factory($value) { 
  9.  
  10. // var_dump($value); 
  11. if (is_object($value) && $value instanceof Alg_TerminalExpression) { 
  12. return $value; 
  13. } elseif (is_numeric($value)) { 
  14. return new Alg_Number($value); 
  15. } elseif ($value == '+') { 
  16. return new Alg_Addition($value); 
  17. } elseif ($value == '-') { 
  18. return new Alg_Subtraction($value); 
  19. } elseif ($value == '*') { 
  20. return new Alg_Multiplication($value); 
  21. } elseif ($value == '/') { 
  22. return new Alg_Division($value); 
  23. } elseif (in_array($value, array('(', ')'))) { 
  24. return new Alg_Parenthesis($value); 
  25. } elseif ($value == '^') { 
  26. return new Alg_Power($value); 
  27. throw new Exception('Undefined Value ' . $value); 
  28.  
  29. abstract public function operate(Alg_Stack $stack); 
  30.  
  31. public function isOperator() { 
  32. return false; 
  33.  
  34. public function isParenthesis() { 
  35. return false; 
  36.  
  37. public function isNoOp() { 
  38. return false; 
  39.  
  40. public function render() { 
  41. return $this->value;