Code Duplication    Length = 11-13 lines in 3 locations

src/Expressions/Comparison.php 1 location

@@ 23-35 (lines=13) @@
20
*/
21
namespace SimpleMath\Expressions;
22
23
abstract class Comparison extends Operator {
24
25
    protected $precidence = 3;
26
27
    public function operate(\SimpleMath\Stack $stack, $variables=array())
28
    {
29
        $right = $stack->pop()->operate($stack, $variables);
30
        $left = $stack->pop()->operate($stack, $variables);
31
        return $this->cmp($left, $right) ? 1 : 0;
32
    }
33
34
    abstract protected function cmp($left, $right);
35
}
36

src/Expressions/Division.php 1 location

@@ 23-33 (lines=11) @@
20
*/
21
namespace SimpleMath\Expressions;
22
23
class Division extends Operator {
24
25
    protected $precidence = 5;
26
27
    public function operate(\SimpleMath\Stack $stack, $variables=array()) {
28
        $left = $stack->pop()->operate($stack, $variables);
29
        $right = $stack->pop()->operate($stack, $variables);
30
        return $right / $left;
31
    }
32
33
}
34

src/Expressions/Modulo.php 1 location

@@ 23-33 (lines=11) @@
20
*/
21
namespace SimpleMath\Expressions;
22
23
class Modulo extends Operator {
24
25
    protected $precidence = 5;
26
27
    public function operate(\SimpleMath\Stack $stack, $variables=array()) {
28
        $left = $stack->pop()->operate($stack, $variables);
29
        $right = $stack->pop()->operate($stack, $variables);
30
        return $right % $left;
31
    }
32
33
}
34