protected function checkRequestsPerMinute(Connection $connection)
    {
        $id = $connection->getId();

        if (!isset($this->requests[$id])) {
            $this->requests[$id] = [];
        }

        // Add current token
        $this->requests[$id][] = time();

        // Expire old tokens
        while (reset($this->requests[$id]) < time() - 60) {
            array_shift($this->requests[$id]);
        }

        if (count($this->requests[$id]) > $this->options['requests_per_minute']) {
            $this->limit($connection, 'Requests per minute');
        }
    }
protected function checkRequestsPerMinute(Connection $connection)
    {
        $id = $connection->getId();

        if (!isset($this->requests[$id])) {
            $this->requests[$id] = [];
        }

        // Add current token
        $this->requests[$id][] = time();

        // Expire old tokens
        while (reset($this->requests[$id]) < time() - 60) {
            array_shift($this->requests[$id]);
        }

        if (count($this->requests[$id]) > $this->options['requests_per_minute']) {
            $this->limit($connection, 'Requests per minute');
        }
    }
protected function checkRequestsPerMinute ( Connection $ connection ) { $ id = $ connection -> getId ( ) ; if ( ! isset ( $ this -> requests [ $ id ] ) ) { $ this -> requests [ $ id ] = [ ] ; } // Add current token $ this -> requests [ $ id ] [ ] = time ( ) ; // Expire old tokens while ( reset ( $ this -> requests [ $ id ] ) < time ( ) - 60 ) { array_shift ( $ this -> requests [ $ id ] ) ; } if ( count ( $ this -> requests [ $ id ] ) > $ this -> options [ 'requests_per_minute' ] ) { $ this -> limit ( $ connection , 'Requests per minute' ) ; } }
NOT idempotent, call once per data

@param Connection $connection
NOT idempotent call once per data