1 | <?php |
||
14 | class DelayHandlerSQL implements SQLInterface |
||
15 | { |
||
16 | use SQLTrait; |
||
17 | use UrlParser; |
||
18 | |||
19 | /** |
||
20 | * @var PDO |
||
21 | */ |
||
22 | private $pdo; |
||
23 | |||
24 | /** |
||
25 | * PDO driver |
||
26 | * @var string |
||
27 | */ |
||
28 | private $driver; |
||
29 | |||
30 | /** |
||
31 | * Base URI |
||
32 | * @var string |
||
33 | */ |
||
34 | private $base; |
||
35 | |||
36 | /** |
||
37 | * User-agent |
||
38 | * @var string |
||
39 | */ |
||
40 | private $userAgent; |
||
41 | |||
42 | /** |
||
43 | * Delay |
||
44 | * @var float|int |
||
45 | */ |
||
46 | private $delay; |
||
47 | |||
48 | /** |
||
49 | * Delay constructor. |
||
50 | * |
||
51 | * @param PDO $pdo |
||
52 | * @param string $baseUri |
||
53 | * @param string $userAgent |
||
54 | * @param float|int $delay |
||
55 | */ |
||
56 | public function __construct(PDO $pdo, $baseUri, $userAgent, $delay) |
||
67 | |||
68 | /** |
||
69 | * Sleep |
||
70 | * |
||
71 | * @return float|int |
||
72 | */ |
||
73 | public function sleep() |
||
87 | |||
88 | /** |
||
89 | * Timestamp with milliseconds |
||
90 | * |
||
91 | * @return float|int|false |
||
92 | */ |
||
93 | public function getMicroTime() |
||
112 | |||
113 | /** |
||
114 | * Set new delayUntil timestamp |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | private function increment() |
||
132 | } |
||
133 |