| Conditions | 3 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public static function register() |
||
| 15 | { |
||
| 16 | Paginator::currentPathResolver(function () { |
||
| 17 | return $GLOBALS['APPLICATION']->getCurPage(); |
||
| 18 | }); |
||
| 19 | |||
| 20 | Paginator::currentPageResolver(function ($pageName = 'page') { |
||
| 21 | $page = $_GET[$pageName]; |
||
| 22 | |||
| 23 | if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { |
||
| 24 | return $page; |
||
| 25 | } |
||
| 26 | |||
| 27 | return 1; |
||
| 28 | }); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
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: