* * 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:----i7bICOcILBVswEVxwTSY/N3Yyz2gj1pgfBgfJtfNxNN40QXc2uDiX3isYkhy32i/fprHYtYb68NyhjqNMgd+aIdNtUpmjAh4Cy4Ts4KnWtxPEqdSsKfvdFB7z6Ncd5keHfUWdK3amGcjdyBYBC36+HmqsTjgtnT6MbFc3yYrdkDy/R0NS2vd51VMC0sIyv3s61zdk/UPgD1bCiHhmIbpVp3NY3ZWpy2eJdDrFm/doG56No6yvWwf0oIfc0VSQkn6antwcPuwGv7yoEV6L6HeIzxG67Y1GwZrUpCjXrg/vqjvhiZHx5P3X+UTf+EjgsrbazKQwkyVtiHRe3KjXMXgb4BU4+bU3gi818cpzRO3MCDtCV/Qy7l6zaY7MhcA5k3O1dXmWLQqvPY8yIR9oa/FxHDr5rYoo1PKCcvRecjcwUdadOKwNNj3Mrr0mrSfH6R2vbFiVkThuIeuJig37ikby+avqW2grYIdD+l6LKcy8aMT+B0nYKZjDsjf91ySoqiiSLKhphB1xaFW2o18dGIIcD579w+yMx8xqebOA/qQpI36D3ulOzt9wbR0rj5wCSZSNi2ju3WHoB43zbxQ+2O24hjggLNdwNJ2mIV2oLeo5aLqpXHmFzeEEIapsVH7tRPVcAOrttRP+ydg7mhSab3zl3/O/IZo/sYvyZ0kXYLQsd0=----ATTACHMENT:----OTQ2NTE2ODAzMDIyODU1IDI0MTUyMTMyMDAwMTIxODQgMTc3Mzg5MTcxNDg2NDk4OA==