public function describeRate($maxRequests, $timeWindow)
    {
        if ($maxRequests && $timeWindow) {
            list($value, $unit) = $this->splitTimeWindow($timeWindow);
            switch ($unit) {
                case 60:
                    $duration = Unit::format($value, 'duration/minute', 'long');
                    break;
                case 3600:
                    $duration = Unit::format($value, 'duration/hour', 'long');
                    break;
                case 86400:
                    $duration = Unit::format($value, 'duration/day', 'long');
                    break;
                case 604800:
                    $duration = Unit::format($value, 'duration/week', 'long');
                    break;
                default:
                    $duration = Unit::format($timeWindow, 'duration/second', 'long');
                    break;
            }
            $result = t2('%1$d request every %2$s', '%1$d requests every %2$s', $maxRequests, $duration);
        } else {
            $result = '';
        }

        return $result;
    }
public function describeRate($maxRequests, $timeWindow)
    {
        if ($maxRequests && $timeWindow) {
            list($value, $unit) = $this->splitTimeWindow($timeWindow);
            switch ($unit) {
                case 60:
                    $duration = Unit::format($value, 'duration/minute', 'long');
                    break;
                case 3600:
                    $duration = Unit::format($value, 'duration/hour', 'long');
                    break;
                case 86400:
                    $duration = Unit::format($value, 'duration/day', 'long');
                    break;
                case 604800:
                    $duration = Unit::format($value, 'duration/week', 'long');
                    break;
                default:
                    $duration = Unit::format($timeWindow, 'duration/second', 'long');
                    break;
            }
            $result = t2('%1$d request every %2$s', '%1$d requests every %2$s', $maxRequests, $duration);
        } else {
            $result = '';
        }

        return $result;
    }
public function describeRate ( $ maxRequests , $ timeWindow ) { if ( $ maxRequests && $ timeWindow ) { list ( $ value , $ unit ) = $ this -> splitTimeWindow ( $ timeWindow ) ; switch ( $ unit ) { case 60 : $ duration = Unit :: format ( $ value , 'duration/minute' , 'long' ) ; break ; case 3600 : $ duration = Unit :: format ( $ value , 'duration/hour' , 'long' ) ; break ; case 86400 : $ duration = Unit :: format ( $ value , 'duration/day' , 'long' ) ; break ; case 604800 : $ duration = Unit :: format ( $ value , 'duration/week' , 'long' ) ; break ; default : $ duration = Unit :: format ( $ timeWindow , 'duration/second' , 'long' ) ; break ; } $ result = t2 ( '%1$d request every %2$s' , '%1$d requests every %2$s' , $ maxRequests , $ duration ) ; } else { $ result = '' ; } return $ result ; }
Format a rate limit.

@param int|null $maxRequests
@param int|null $timeWindow

@return string

@example: '2 requests every 1 hour'
Format a rate limit .