* * 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:----vvSbWbiHnn1i9rQLVD12gcUGrBF0NszmuruaIcFFq55hZA91blwkWjevMEEPNEJG7qVMVeEdYkXgVRafqDi8SttCPPvHNkoH7N5ed/r/ZXwgUNt9FzceVFZwejfFSGJESWZyWWh5pzcSQyWJQykrAIEXJNkiFFMfqCeFLnNIey7dgKHzFi131g5pmnF6yaMvD5YLtPjGK4z7a6oULbIPDoxkvtsk8+QzIZCjud3AIMr/mXSxO9+4H4+op9AnXQPxd1INVuQfMoPKbAl+eMJ1IrjeQSXkZrAmnTxP9+yObI4R0gQFNbyOc1/pOZ6WZhdv5eGmh9klXXQA0KAe5ddHICjCb0ade3AWfkUQ3qR/juZbSFljjWrrwGxTmnFYT3I+hcKUBKzoFxm4+ozaoC1q34r0NTu9EKQVmhkw1tPlQAw10pFvJ2v0APVCpYvOKNaRsfL6BUcW7KBSPmJBq1XVd5jhVx1GM+yuJH33qZaBc9Z/La00SX1cwsOuTKmY28BQnuIqqtu/eRG3GVmGsDEvxgMLnC6OAvdxbemS0PnRPMamk1MeV4GJQksOkBvCs+nK/xE7fT0NnzMH2lN5jSvmDJ1BFrROtKmda+Apou6H2wZcEgjm2bOXBrLLsTRwNwWLMw6PLAcNipNsGr7QgUa36YAeW5mXmHLZGOXQ46iInBI=----ATTACHMENT:----NTMxMzgyMTcxNDczMDAwIDE1NDc2NjQzNTUwMDY4MjIgNTI3ODQ5ODY1NTUxMDkyMA==