src/Expressions/Addition.php 1 location
|
@@ 23-31 (lines=9) @@
|
| 20 |
|
*/ |
| 21 |
|
namespace SimpleMath\Expressions; |
| 22 |
|
|
| 23 |
|
class Addition extends Operator { |
| 24 |
|
|
| 25 |
|
protected $precidence = 4; |
| 26 |
|
|
| 27 |
|
public function operate(\SimpleMath\Stack $stack, $variables=array()) { |
| 28 |
|
return $stack->pop()->operate($stack, $variables) + $stack->pop()->operate($stack, $variables); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
} |
| 32 |
|
|
src/Expressions/Multiplication.php 1 location
|
@@ 23-31 (lines=9) @@
|
| 20 |
|
*/ |
| 21 |
|
namespace SimpleMath\Expressions; |
| 22 |
|
|
| 23 |
|
class Multiplication extends Operator { |
| 24 |
|
|
| 25 |
|
protected $precidence = 5; |
| 26 |
|
|
| 27 |
|
public function operate(\SimpleMath\Stack $stack, $variables=array()) { |
| 28 |
|
return $stack->pop()->operate($stack, $variables) * $stack->pop()->operate($stack, $variables); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
|