public function spin($lambda)
    {
        $e = null;
        $timeLimit = time() + self::SPIN_TIMEOUT;
        do {
            try {
                $return = $lambda($this);
                if ($return) {
                    return $return;
                }
            } catch (\Exception $e) {
            }

            $this->sleep();
        } while ($timeLimit > time());

        throw new \Exception(
            'Timeout while retreaving DOM element' .
            ($e !== null ? '. Last exception: ' . $e->getMessage() : '')
        );
    }
public function spin($lambda)
    {
        $e = null;
        $timeLimit = time() + self::SPIN_TIMEOUT;
        do {
            try {
                $return = $lambda($this);
                if ($return) {
                    return $return;
                }
            } catch (\Exception $e) {
            }

            $this->sleep();
        } while ($timeLimit > time());

        throw new \Exception(
            'Timeout while retreaving DOM element' .
            ($e !== null ? '. Last exception: ' . $e->getMessage() : '')
        );
    }
public function spin ( $ lambda ) { $ e = null ; $ timeLimit = time ( ) + self :: SPIN_TIMEOUT ; do { try { $ return = $ lambda ( $ this ) ; if ( $ return ) { return $ return ; } } catch ( \ Exception $ e ) { } $ this -> sleep ( ) ; } while ( $ timeLimit > time ( ) ) ; throw new \ Exception ( 'Timeout while retreaving DOM element' . ( $ e !== null ? '. Last exception: ' . $ e -> getMessage ( ) : '' ) ) ; }
Behat spin function
Execute a provided function and return it's result if valid,
if an exception is thrown or the result is false wait and retry
until a max timeout is reached.
Behat spin function Execute a provided function and return it s result if valid if an exception is thrown or the result is false wait and retry until a max timeout is reached .