1 | <?php |
||
10 | abstract class AbstractLeaderboardEndpointController extends AbstractEndpointController |
||
11 | { |
||
12 | /** |
||
13 | * Validates the request variables |
||
14 | * |
||
15 | * @throws InvalidArgumentException |
||
16 | * @return boolean |
||
17 | */ |
||
18 | public function validateRequestVars() |
||
42 | |||
43 | /** |
||
44 | * Validate the field requested |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | public function parseField($field) |
||
65 | |||
66 | /** |
||
67 | * Validate the server requested |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function parseServer($server) |
||
86 | |||
87 | /** |
||
88 | * Parses limit, making sure it's numerical and valid |
||
89 | * |
||
90 | * @return boolean |
||
91 | */ |
||
92 | public function parseLimit($limit) |
||
100 | |||
101 | /** |
||
102 | * Parses offset, making sure it's numerical and valid |
||
103 | */ |
||
104 | public function parseOffset($offset) |
||
112 | } |
||
113 |
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: