private function canProceed($request) : bool
  {
    $time = $this->decay - date('s');

    if ($request->cookies->has('clusters')) {
      $value = $request->cookie('clusters');
      $value = $this->hashids->decode($value)[0] - 1;

      if ($value == 0) {
        $this->withHeaders($request, $value, $time);
        return false;
      }

      $this->cookie->setExpireTime($time);
      $this->cookie->setValue($this->hashids->encode($value));

      $this->withHeaders($request, $value);

      return true;
    }

    $this->cookie->setValue($this->hashids->encode($this->max));
    $this->withHeaders($request, $this->max);

    return true;
  }
private function canProceed($request) : bool
  {
    $time = $this->decay - date('s');

    if ($request->cookies->has('clusters')) {
      $value = $request->cookie('clusters');
      $value = $this->hashids->decode($value)[0] - 1;

      if ($value == 0) {
        $this->withHeaders($request, $value, $time);
        return false;
      }

      $this->cookie->setExpireTime($time);
      $this->cookie->setValue($this->hashids->encode($value));

      $this->withHeaders($request, $value);

      return true;
    }

    $this->cookie->setValue($this->hashids->encode($this->max));
    $this->withHeaders($request, $this->max);

    return true;
  }
private function canProceed ( $ request ) : bool { $ time = $ this -> decay - date ( 's' ) ; if ( $ request -> cookies -> has ( 'clusters' ) ) { $ value = $ request -> cookie ( 'clusters' ) ; $ value = $ this -> hashids -> decode ( $ value ) [ 0 ] - 1 ; if ( $ value == 0 ) { $ this -> withHeaders ( $ request , $ value , $ time ) ; return false ; } $ this -> cookie -> setExpireTime ( $ time ) ; $ this -> cookie -> setValue ( $ this -> hashids -> encode ( $ value ) ) ; $ this -> withHeaders ( $ request , $ value ) ; return true ; } $ this -> cookie -> setValue ( $ this -> hashids -> encode ( $ this -> max ) ) ; $ this -> withHeaders ( $ request , $ this -> max ) ; return true ; }
Check if request can proceed

@param  \Modulus\Http\Request $request
@return bool
Check if request can proceed