public function ping()
    {
        if (!$this->key || $this->operationInProgress || (time() - $this->lastPing) < $this->pingInterval) {
            // Attempt a new handshake.
            if (is_null($this->key) && (time() - $this->lastPing) > $this->retryInterval) {
                $this->lastPing = time();
                $this->handshake();
            }

            return;
        }

        $data = $this->getBasePingData();
        $query = http_build_query(
            $data
        );
        $url = $this->pingUrl . '?' . $query;

        $this->operationInProgress = true;
        $this->lastPing = time();
        $operationInProgress = &$this->operationInProgress;
        $key = &$this->key;
        $logger = $this->logger;

        $logger->debug('[eXpansion analytics]Starting ping');
        $this->http->put(
            $url,
            [],
            function (HttpResult $result) use (&$operationInProgress, &$key, $logger) {
                if ($result->getHttpCode() == '200') {
                    $operationInProgress = false;
                    $logger->debug('[eXpansion analytics]Ping successfull');
                } else {
                    $logger->debug('[eXpansion analytics]Ping failed', ['http_code' => $result->getHttpCode(), 'result' => $result->getResponse()]);
                    $key = null;
                }
            }
        );
    }
public function ping()
    {
        if (!$this->key || $this->operationInProgress || (time() - $this->lastPing) < $this->pingInterval) {
            // Attempt a new handshake.
            if (is_null($this->key) && (time() - $this->lastPing) > $this->retryInterval) {
                $this->lastPing = time();
                $this->handshake();
            }

            return;
        }

        $data = $this->getBasePingData();
        $query = http_build_query(
            $data
        );
        $url = $this->pingUrl . '?' . $query;

        $this->operationInProgress = true;
        $this->lastPing = time();
        $operationInProgress = &$this->operationInProgress;
        $key = &$this->key;
        $logger = $this->logger;

        $logger->debug('[eXpansion analytics]Starting ping');
        $this->http->put(
            $url,
            [],
            function (HttpResult $result) use (&$operationInProgress, &$key, $logger) {
                if ($result->getHttpCode() == '200') {
                    $operationInProgress = false;
                    $logger->debug('[eXpansion analytics]Ping successfull');
                } else {
                    $logger->debug('[eXpansion analytics]Ping failed', ['http_code' => $result->getHttpCode(), 'result' => $result->getResponse()]);
                    $key = null;
                }
            }
        );
    }
public function ping ( ) { if ( ! $ this -> key || $ this -> operationInProgress || ( time ( ) - $ this -> lastPing ) < $ this -> pingInterval ) { // Attempt a new handshake. if ( is_null ( $ this -> key ) && ( time ( ) - $ this -> lastPing ) > $ this -> retryInterval ) { $ this -> lastPing = time ( ) ; $ this -> handshake ( ) ; } return ; } $ data = $ this -> getBasePingData ( ) ; $ query = http_build_query ( $ data ) ; $ url = $ this -> pingUrl . '?' . $ query ; $ this -> operationInProgress = true ; $ this -> lastPing = time ( ) ; $ operationInProgress = & $ this -> operationInProgress ; $ key = & $ this -> key ; $ logger = $ this -> logger ; $ logger -> debug ( '[eXpansion analytics]Starting ping' ) ; $ this -> http -> put ( $ url , [ ] , function ( HttpResult $ result ) use ( & $ operationInProgress , & $ key , $ logger ) { if ( $ result -> getHttpCode ( ) == '200' ) { $ operationInProgress = false ; $ logger -> debug ( '[eXpansion analytics]Ping successfull' ) ; } else { $ logger -> debug ( '[eXpansion analytics]Ping failed' , [ 'http_code' => $ result -> getHttpCode ( ) , 'result' => $ result -> getResponse ( ) ] ) ; $ key = null ; } } ) ; }
Ping the analytics server with proper information.
Ping the analytics server with proper information .