1 | <?php |
||
26 | abstract class AbstractQueueHandler |
||
27 | { |
||
28 | /** |
||
29 | * @var GeneralConfigProviderInterface |
||
30 | */ |
||
31 | protected $configProvider; |
||
32 | |||
33 | /** |
||
34 | * @var LoggerInterface |
||
35 | */ |
||
36 | protected $logger; |
||
37 | |||
38 | /** |
||
39 | * @var QueueProgressLoggerInterface |
||
40 | */ |
||
41 | protected $queueProgressLogger; |
||
42 | |||
43 | /** |
||
44 | * @var LoopInterface |
||
45 | */ |
||
46 | protected $loop; |
||
47 | |||
48 | /** |
||
49 | * @var int |
||
50 | */ |
||
51 | protected $counter = 0; |
||
52 | |||
53 | /** |
||
54 | * @var int |
||
55 | */ |
||
56 | protected $total = 0; |
||
57 | |||
58 | /** |
||
59 | * @var array |
||
60 | */ |
||
61 | protected $urls = []; |
||
62 | |||
63 | /** |
||
64 | * @var ClientFactory |
||
65 | */ |
||
66 | protected $clientFactory; |
||
67 | |||
68 | /** |
||
69 | * AbstractQueueHandler constructor. |
||
70 | * @param GeneralConfigProviderInterface $configProvider |
||
71 | * @param LoggerInterface $logger |
||
72 | * @param QueueProgressLoggerInterface $queueProgressLogger |
||
73 | * @param Factory $loopFactory |
||
74 | * @param ClientFactory $clientFactory |
||
75 | */ |
||
76 | public function __construct( |
||
89 | |||
90 | /** |
||
91 | * @return int |
||
92 | */ |
||
93 | abstract protected function getMaxNumberOfProcesses(): int; |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | abstract protected function getQueueProcessType(): string; |
||
99 | |||
100 | /** |
||
101 | * @param string $url |
||
102 | * @return void |
||
103 | */ |
||
104 | abstract protected function createRequest(string $url): void; |
||
105 | |||
106 | /** |
||
107 | * @return void |
||
108 | */ |
||
109 | protected function runQueue(): void |
||
121 | |||
122 | /** |
||
123 | * @param string $url |
||
124 | * @return void |
||
125 | */ |
||
126 | protected function log(string $url): void |
||
130 | |||
131 | /** |
||
132 | * @return int |
||
133 | */ |
||
134 | protected function getNumberOfParallelProcesses(): int |
||
138 | |||
139 | /** |
||
140 | * @return void |
||
141 | */ |
||
142 | protected function logProgress(): void |
||
146 | } |
||
147 |