1 | <?php |
||
22 | class PurgeLimiter extends AbstractPersistence |
||
23 | { |
||
24 | /** |
||
25 | * time limit in seconds, defaults to 300s |
||
26 | * |
||
27 | * @access private |
||
28 | * @static |
||
29 | * @var int |
||
30 | */ |
||
31 | private static $_limit = 300; |
||
32 | |||
33 | /** |
||
34 | * set the time limit in seconds |
||
35 | * |
||
36 | * @access public |
||
37 | * @static |
||
38 | * @param int $limit |
||
39 | */ |
||
40 | 30 | public static function setLimit($limit) |
|
44 | |||
45 | /** |
||
46 | * set configuration options of the traffic limiter |
||
47 | * |
||
48 | * @access public |
||
49 | * @static |
||
50 | * @param Configuration $conf |
||
51 | */ |
||
52 | 29 | public static function setConfiguration(Configuration $conf) |
|
57 | |||
58 | /** |
||
59 | * check if the purge can be performed |
||
60 | * |
||
61 | * @access public |
||
62 | * @static |
||
63 | * @throws Exception |
||
64 | * @return bool |
||
65 | */ |
||
66 | 30 | public static function canPurge() |
|
92 | } |
||
93 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: