protected function addHeader($signature, $tooManyAttempts = false)
    {
        /** @var \Phalcon\Http\Response $response */
        $response = $this->getDI()->getShared(Services::RESPONSE);

        $limiter = $this->getLimiter();

        $response->setHeader('X-RateLimit-Limit', $this->max);
        if ($tooManyAttempts) {
            $msg = StatusCode::message(StatusCode::TOO_MANY_REQUESTS);

            $response
                ->setContent($msg)
                ->setStatusCode(StatusCode::TOO_MANY_REQUESTS, $msg)
                ->setHeader('X-RateLimit-Remaining', 0)
                ->setHeader(
                'Retry-After',
                $limiter->availableIn($signature, $this->decay)
            );
        } else {
            $response->setHeader(
                'X-RateLimit-Remaining',
                $limiter->retriesLeft($signature, $this->max, $this->decay)
            );
        }
    }
protected function addHeader($signature, $tooManyAttempts = false)
    {
        /** @var \Phalcon\Http\Response $response */
        $response = $this->getDI()->getShared(Services::RESPONSE);

        $limiter = $this->getLimiter();

        $response->setHeader('X-RateLimit-Limit', $this->max);
        if ($tooManyAttempts) {
            $msg = StatusCode::message(StatusCode::TOO_MANY_REQUESTS);

            $response
                ->setContent($msg)
                ->setStatusCode(StatusCode::TOO_MANY_REQUESTS, $msg)
                ->setHeader('X-RateLimit-Remaining', 0)
                ->setHeader(
                'Retry-After',
                $limiter->availableIn($signature, $this->decay)
            );
        } else {
            $response->setHeader(
                'X-RateLimit-Remaining',
                $limiter->retriesLeft($signature, $this->max, $this->decay)
            );
        }
    }
protected function addHeader ( $ signature , $ tooManyAttempts = false ) { /** @var \Phalcon\Http\Response $response */ $ response = $ this -> getDI ( ) -> getShared ( Services :: RESPONSE ) ; $ limiter = $ this -> getLimiter ( ) ; $ response -> setHeader ( 'X-RateLimit-Limit' , $ this -> max ) ; if ( $ tooManyAttempts ) { $ msg = StatusCode :: message ( StatusCode :: TOO_MANY_REQUESTS ) ; $ response -> setContent ( $ msg ) -> setStatusCode ( StatusCode :: TOO_MANY_REQUESTS , $ msg ) -> setHeader ( 'X-RateLimit-Remaining' , 0 ) -> setHeader ( 'Retry-After' , $ limiter -> availableIn ( $ signature , $ this -> decay ) ) ; } else { $ response -> setHeader ( 'X-RateLimit-Remaining' , $ limiter -> retriesLeft ( $ signature , $ this -> max , $ this -> decay ) ) ; } }
Add the limit header information to the response.

@param string $signature
@param bool   $tooManyAttempts Bind specific values when there are too many attempts
Add the limit header information to the response .