private function moveWithCondition(callable $condition, $direction = self::DIR_FORWARD)
    {
        while ($condition()) {
            $this->move($direction);

            if (!$this->valid()) {
                throw $this->getOutOfBoundsException();
            }
        }

        return $this;
    }
private function moveWithCondition(callable $condition, $direction = self::DIR_FORWARD)
    {
        while ($condition()) {
            $this->move($direction);

            if (!$this->valid()) {
                throw $this->getOutOfBoundsException();
            }
        }

        return $this;
    }
private function moveWithCondition ( callable $ condition , $ direction = self :: DIR_FORWARD ) { while ( $ condition ( ) ) { $ this -> move ( $ direction ) ; if ( ! $ this -> valid ( ) ) { throw $ this -> getOutOfBoundsException ( ) ; } } return $ this ; }
Moves the positon based on a direction, until the given condition is fulfilled.

@param callable $condition
@param int      $direction

@return void
Moves the positon based on a direction until the given condition is fulfilled .