protected function delay($type, $argument = null)
    {
        // Based on the given type, we will generate method and property names
        $method = 'get'.studly_case($type).'Throttles';

        $thresholds = $type.'Thresholds';

        $throttles = $this->{$method}($argument);

        if (! $throttles->count()) {
            return 0;
        }

        if (is_array($this->$thresholds)) {
            // Great, now we compare our delay against the most recent attempt
            $last = $throttles->last();

            foreach (array_reverse($this->$thresholds, true) as $attempts => $delay) {
                if ($throttles->count() <= $attempts) {
                    continue;
                }

                if ($last->created_at->diffInSeconds() < $delay) {
                    return $this->secondsToFree($last, $delay);
                }
            }
        } elseif ($throttles->count() >= $this->$thresholds) {
            $interval = $type.'Interval';

            $first = $throttles->first();

            return $this->secondsToFree($first, $this->{$interval});
        }

        return 0;
    }
protected function delay($type, $argument = null)
    {
        // Based on the given type, we will generate method and property names
        $method = 'get'.studly_case($type).'Throttles';

        $thresholds = $type.'Thresholds';

        $throttles = $this->{$method}($argument);

        if (! $throttles->count()) {
            return 0;
        }

        if (is_array($this->$thresholds)) {
            // Great, now we compare our delay against the most recent attempt
            $last = $throttles->last();

            foreach (array_reverse($this->$thresholds, true) as $attempts => $delay) {
                if ($throttles->count() <= $attempts) {
                    continue;
                }

                if ($last->created_at->diffInSeconds() < $delay) {
                    return $this->secondsToFree($last, $delay);
                }
            }
        } elseif ($throttles->count() >= $this->$thresholds) {
            $interval = $type.'Interval';

            $first = $throttles->first();

            return $this->secondsToFree($first, $this->{$interval});
        }

        return 0;
    }
protected function delay ( $ type , $ argument = null ) { // Based on the given type, we will generate method and property names $ method = 'get' . studly_case ( $ type ) . 'Throttles' ; $ thresholds = $ type . 'Thresholds' ; $ throttles = $ this -> { $ method } ( $ argument ) ; if ( ! $ throttles -> count ( ) ) { return 0 ; } if ( is_array ( $ this -> $ thresholds ) ) { // Great, now we compare our delay against the most recent attempt $ last = $ throttles -> last ( ) ; foreach ( array_reverse ( $ this -> $ thresholds , true ) as $ attempts => $ delay ) { if ( $ throttles -> count ( ) <= $ attempts ) { continue ; } if ( $ last -> created_at -> diffInSeconds ( ) < $ delay ) { return $ this -> secondsToFree ( $ last , $ delay ) ; } } } elseif ( $ throttles -> count ( ) >= $ this -> $ thresholds ) { $ interval = $ type . 'Interval' ; $ first = $ throttles -> first ( ) ; return $ this -> secondsToFree ( $ first , $ this -> { $ interval } ) ; } return 0 ; }
Returns a delay for the given type.

@param  string  $type
@param  mixed  $argument
@return int
Returns a delay for the given type .