Completed
Push — master ( 4e273d...70dc6f )
by Ilias
02:12
created

OperandStack::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
4
namespace CondParse;
5
6
7
class OperandStack
8
{
9
    /** @var \SplStack */
10
    private $stack;
11
12 31
    public function __construct()
13
    {
14 31
        $this->stack = new \SplStack();
15 31
    }
16
17
    /**
18
     * @param OperandInterface $operand
19
     */
20 24
    public function push(OperandInterface $operand)
21
    {
22 24
        $this->stack->push($operand);
23 24
    }
24
25
    /**
26
     * @return OperandInterface
27
     */
28 18
    public function pop()
29
    {
30 18
        return $this->stack->pop();
31
    }
32
33
    /**
34
     * @return OperandInterface
35
     */
36 12
    public function top()
37
    {
38 12
        return $this->stack->top();
39
    }
40
41
    /**
42
     * @return bool
43
     */
44 16
    public function isEmpty()
45
    {
46 16
        return $this->stack->isEmpty();
47
    }
48
}
49