private function retry(
        RequestInterface $request,
        array $options,
        ResponseInterface $response = null
    ) {
        $options['delay'] = call_user_func(
            $this->intervalCalculator,
            ++$options['retries']
        );

        //Change the request URI according to the location mode.
        if (array_key_exists(Resources::ROS_LOCATION_MODE, $options)) {
            $locationMode = $options[Resources::ROS_LOCATION_MODE];
            //If have RA-GRS enabled for the request, switch between
            //primary and secondary.
            if ($locationMode == LocationMode::PRIMARY_THEN_SECONDARY ||
                $locationMode == LocationMode::SECONDARY_THEN_PRIMARY) {
                $primaryUri = $options[Resources::ROS_PRIMARY_URI];
                $secondaryUri = $options[Resources::ROS_SECONDARY_URI];

                $target = $request->getRequestTarget();
                if (Utilities::startsWith($target, '/')) {
                    $target = substr($target, 1);
                    $primaryUri = new Uri($primaryUri . $target);
                    $secondaryUri = new Uri($secondaryUri . $target);
                }

                //substitute the uri.
                if ((string)$request->getUri() == (string)$primaryUri) {
                    $request = $request->withUri($secondaryUri);
                } elseif ((string)$request->getUri() == (string)$secondaryUri) {
                    $request = $request->withUri($primaryUri);
                }
            }
        }
        $handler = $options[Resources::ROS_HANDLER];

        return \call_user_func($handler, $request, $options);
    }
private function retry(
        RequestInterface $request,
        array $options,
        ResponseInterface $response = null
    ) {
        $options['delay'] = call_user_func(
            $this->intervalCalculator,
            ++$options['retries']
        );

        //Change the request URI according to the location mode.
        if (array_key_exists(Resources::ROS_LOCATION_MODE, $options)) {
            $locationMode = $options[Resources::ROS_LOCATION_MODE];
            //If have RA-GRS enabled for the request, switch between
            //primary and secondary.
            if ($locationMode == LocationMode::PRIMARY_THEN_SECONDARY ||
                $locationMode == LocationMode::SECONDARY_THEN_PRIMARY) {
                $primaryUri = $options[Resources::ROS_PRIMARY_URI];
                $secondaryUri = $options[Resources::ROS_SECONDARY_URI];

                $target = $request->getRequestTarget();
                if (Utilities::startsWith($target, '/')) {
                    $target = substr($target, 1);
                    $primaryUri = new Uri($primaryUri . $target);
                    $secondaryUri = new Uri($secondaryUri . $target);
                }

                //substitute the uri.
                if ((string)$request->getUri() == (string)$primaryUri) {
                    $request = $request->withUri($secondaryUri);
                } elseif ((string)$request->getUri() == (string)$secondaryUri) {
                    $request = $request->withUri($primaryUri);
                }
            }
        }
        $handler = $options[Resources::ROS_HANDLER];

        return \call_user_func($handler, $request, $options);
    }
private function retry ( RequestInterface $ request , array $ options , ResponseInterface $ response = null ) { $ options [ 'delay' ] = call_user_func ( $ this -> intervalCalculator , ++ $ options [ 'retries' ] ) ; //Change the request URI according to the location mode. if ( array_key_exists ( Resources :: ROS_LOCATION_MODE , $ options ) ) { $ locationMode = $ options [ Resources :: ROS_LOCATION_MODE ] ; //If have RA-GRS enabled for the request, switch between //primary and secondary. if ( $ locationMode == LocationMode :: PRIMARY_THEN_SECONDARY || $ locationMode == LocationMode :: SECONDARY_THEN_PRIMARY ) { $ primaryUri = $ options [ Resources :: ROS_PRIMARY_URI ] ; $ secondaryUri = $ options [ Resources :: ROS_SECONDARY_URI ] ; $ target = $ request -> getRequestTarget ( ) ; if ( Utilities :: startsWith ( $ target , '/' ) ) { $ target = substr ( $ target , 1 ) ; $ primaryUri = new Uri ( $ primaryUri . $ target ) ; $ secondaryUri = new Uri ( $ secondaryUri . $ target ) ; } //substitute the uri. if ( ( string ) $ request -> getUri ( ) == ( string ) $ primaryUri ) { $ request = $ request -> withUri ( $ secondaryUri ) ; } elseif ( ( string ) $ request -> getUri ( ) == ( string ) $ secondaryUri ) { $ request = $ request -> withUri ( $ primaryUri ) ; } } } $ handler = $ options [ Resources :: ROS_HANDLER ] ; return \ call_user_func ( $ handler , $ request , $ options ) ; }
This function does the real retry job.

@param  RequestInterface  $request  the request sent.
@param  array             $options  the options that the request sent with.
@param  ResponseInterface $response the response of the request

@return callable
This function does the real retry job .