| @@ 166-175 (lines=10) @@ | ||
| 163 | protected function action($command) |
|
| 164 | {
|
|
| 165 | // make sure we don't compress "a + ++b" to "a+++b", etc. |
|
| 166 | if ($command === self::ACTION_DELETE_A_B |
|
| 167 | && $this->b === ' ' |
|
| 168 | && ($this->a === '+' || $this->a === '-')) {
|
|
| 169 | // Note: we're at an addition/substraction operator; the inputIndex |
|
| 170 | // will certainly be a valid index |
|
| 171 | if ($this->input[$this->inputIndex] === $this->a) {
|
|
| 172 | // This is "+ +" or "- -". Don't delete the space. |
|
| 173 | $command = self::ACTION_KEEP_A; |
|
| 174 | } |
|
| 175 | } |
|
| 176 | ||
| 177 | switch ($command) {
|
|
| 178 | case self::ACTION_KEEP_A: // 1 |
|
| @@ 171-180 (lines=10) @@ | ||
| 168 | protected function action($command) |
|
| 169 | { |
|
| 170 | // make sure we don't compress "a + ++b" to "a+++b", etc. |
|
| 171 | if ($command === self::ACTION_DELETE_A_B |
|
| 172 | && $this->b === ' ' |
|
| 173 | && ($this->a === '+' || $this->a === '-')) { |
|
| 174 | // Note: we're at an addition/substraction operator; the inputIndex |
|
| 175 | // will certainly be a valid index |
|
| 176 | if ($this->input[$this->inputIndex] === $this->a) { |
|
| 177 | // This is "+ +" or "- -". Don't delete the space. |
|
| 178 | $command = self::ACTION_KEEP_A; |
|
| 179 | } |
|
| 180 | } |
|
| 181 | ||
| 182 | switch ($command) { |
|
| 183 | case self::ACTION_KEEP_A: // 1 |
|