SproutCMS

This is the code documentation for the SproutCMS project

class RateLimit

Rate-limiting system, to prefent people form doing hacky stuff

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-03
**/
class NewClassName extends RateLimit {
    
    /**
    * Log a hit against the rate-limit system
    **/
    protected function logHit (string $event, bool $success, string $username) {
        // Method code goes here
    }
    
    /**
    * Return the number of hits matching given conditions for a given time period
    **/
    public function getHitCount (array $conditions, int $time) {
        // Method code goes here
    }
    
    /**
    * Check that a given event has only been hit by the request ip address an allowable number of times
    **/
    public function checkLimitIP (string $event, bool|null $success, int $limit, int $time) {
        // Method code goes here
    }
    
    /**
    * Log a failure hit against the rate-limit system (e.g. password incorrect)
    **/
    public function logHitFailure (string $event, string $username) {
        // Method code goes here
    }
    
    /**
    * Log a successful hit against the rate-limit system (e.g. user was logged in)
    **/
    public function logHitSuccess (string $event, string $username) {
        // Method code goes here
    }
    
}
?>