Conditions | 4 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.5923 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 7 | public static function make($callbale, $timeout = 2000, $step = 50) |
|
23 | { |
||
24 | $retries = ceil($timeout / $step); |
||
25 | |||
26 | do |
||
27 | { |
||
28 | $result = $callbale(); |
||
29 | 7 | $retries -= 1; |
|
30 | 7 | if ( ! $result) |
|
31 | { |
||
32 | usleep($step * 1000); |
||
33 | } |
||
34 | } |
||
35 | 7 | while ($retries > 0 AND ! $result); |
|
36 | |||
37 | 7 | return $result; |
|
38 | 3 | } |
|
39 | |||
41 |