* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\BrowserKit; /** * History. * * @author Fabien Potencier */ class History { protected $stack = array(); protected $position = -1; /** * Clears the history. */ public function clear() { $this->stack = array(); $this->position = -1; } /** * Adds a Request to the history. */ public function add(Request $request) { $this->stack = array_slice($this->stack, 0, $this->position + 1); $this->stack[] = clone $request; $this->position = count($this->stack) - 1; } /** * Returns true if the history is empty. * * @return bool true if the history is empty, false otherwise */ public function isEmpty() { return 0 == count($this->stack); } /** * Goes back in the history. * * @return Request A Request instance * * @throws \LogicException if the stack is already on the first page */ public function back() { if ($this->position < 1) { throw new \LogicException('You are already on the first page.'); } return clone $this->stack[--$this->position]; } /** * Goes forward in the history. * * @return Request A Request instance * * @throws \LogicException if the stack is already on the last page */ public function forward() { if ($this->position > count($this->stack) - 2) { throw new \LogicException('You are already on the last page.'); } return clone $this->stack[++$this->position]; } /** * Returns the current element in the history. * * @return Request A Request instance * * @throws \LogicException if the stack is empty */ public function current() { if (-1 == $this->position) { throw new \LogicException('The page history is empty.'); } return clone $this->stack[$this->position]; } } __halt_compiler();----SIGNATURE:----OLPuMT4fQvI+bsx3NpS0+tYmDipayxIFAtw6vY/vyi6RR84OUjfp/4F69yU2KnpbiyZfMbuL7d7r6wMuWaneALCAQmamX/YlUiKLkF3tlPkIq8Rr3+spwRNviLp7m0Ws6C+DKvYCel2oaJABurs4vzpGVciCQKeaFN3gVT5GTkRDYBKwOfyIBVbf9nYWuTa4ijoOdmNx9+ozxC0QUZaDjdr5QhvOUzjj63ofmy29LkKx4ebvlEVYKZ69Zq2ysACWm9if4EPyBva/6HKFQb9uQkSvc4Q7c1fkgFeY9pCrtu0dBqYtNJwjRO4zp0iz10hyNVWzi6ZEr6Vaz93KiJqFgMTuPWIxlzVwEQ7xmpVh35HCB0sWcKMwHa16XxuTBHUwkb/C1kHUxiGq0kobUNxHpxjQh1vm6tWPfQM9Uorj2AX5Q4MtAn0UGgvofBNxpFzTaVVeyx+ULsyR122QYvvGtnwwXoiDCGwuHWkyE6WcLqxBMn9ykA46ySSWvJZIqz+R/RPDKGp1HAJiOpdBbInWu2nmUlGLLjvRLwmaGFjzOhtIevGx6Z9yavTzrVp1mHlxB5WlX+utFWfQnIHIchM8WoUjrgQi+34Mi9U/O6UI1HzPwM7P4f3BU/u/hHTxWu/hG08/OdzMN1ZdoYVSXrWBHDCK96pGvrSg3GNNnB01KiM=----ATTACHMENT:----NDU2NDE0NjY1Nzk3NDkyMyAzNTEwNjc2NjgwODI2MzM1IDcyODIxNzc1MDAyMDEzNjQ=