1 | <?php |
||
11 | class Helpers |
||
12 | { |
||
13 | private static $hash_equals; |
||
14 | |||
15 | /** |
||
16 | * helper function to fix paths '//' or '/./' or '/foo/../' in a path. |
||
17 | * |
||
18 | * @param string $path Path to resolve |
||
19 | * |
||
20 | * @return string |
||
21 | */ |
||
22 | public static function fixPath($path) |
||
33 | |||
34 | /** |
||
35 | * Join several pieces into a path. |
||
36 | * |
||
37 | * @param string |
||
38 | * ... |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public static function joinPath() |
||
46 | |||
47 | /** |
||
48 | * Check whether a request is or not ajax. |
||
49 | * |
||
50 | * @param RequestInterface $request |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | public static function isAjax(RequestInterface $request) |
||
58 | |||
59 | /** |
||
60 | * Check if a request is post or any similar method. |
||
61 | * |
||
62 | * @param RequestInterface $request |
||
63 | * |
||
64 | * @return bool |
||
65 | */ |
||
66 | public static function isPost(RequestInterface $request) |
||
79 | |||
80 | /** |
||
81 | * Check whether a response is a redirection. |
||
82 | * |
||
83 | * @param ResponseInterface $response |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | public static function isRedirect(ResponseInterface $response) |
||
91 | |||
92 | /** |
||
93 | * Return the output buffer. |
||
94 | * |
||
95 | * @param int $level |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | public static function getOutput($level) |
||
109 | |||
110 | /** |
||
111 | * Very short timing attack safe string comparison for PHP < 5.6 |
||
112 | * http://php.net/manual/en/function.hash-equals.php#118384 |
||
113 | * |
||
114 | * @param string $a |
||
115 | * @param string $b |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | public static function hash_equals($a, $b) |
||
131 | } |
||
132 |