1: <?php
2:
3: namespace BN\Compiler\Postfix\Token;
4:
5: use BN\Compiler\Token\Token;
6: use BN\Compiler\Postfix\ProcessToken;
7: use BN\Compiler\Postfix\Variables;
8: use BN\Compiler\Postfix\Operands\FixedCount;
9: use BN\Compiler\Postfix\Operator\AssignOperator;
10:
11: class ProcessAssign extends ProcessToken implements ProcessKeywordStrategy
12: {
13: private $evaluator;
14: private $operands;
15: private $processKeyword;
16:
17: public function __construct($accumulator, Variables $variables)
18: {
19: $this->operands = new FixedCount(2);
20: $this->evaluator = new AssignOperator($variables);
21: $this->processKeyword = new ProcessKeyword($accumulator, $variables, $this);
22: }
23:
24: public function process(Token $token)
25: {
26: return $this->processKeyword->process($token);
27: }
28:
29: public function isFirstOperandVariable()
30: {
31: return true;
32: }
33:
34: public function getOperands()
35: {
36: return $this->operands;
37: }
38:
39: public function tokensToOperands(array $tokens)
40: {
41: return $tokens;
42: }
43:
44: public function getEvaluator()
45: {
46: return $this->evaluator;
47: }
48: }
49: