Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
index.php 0000644 00000000006 15073230155 0006361 0 ustar 00
*/
class BatchIterator implements \Iterator, \Countable {
private $taskId;
private $batchSize;
private $lastProcessedId = 0;
private $batchLastId;
/** @var ScheduledTaskSubscribersRepository */
private $scheduledTaskSubscribersRepository;
public function __construct(
$taskId,
$batchSize
) {
if ($taskId <= 0) {
throw new \Exception('Task ID must be greater than zero');
} elseif ($batchSize <= 0) {
throw new \Exception('Batch size must be greater than zero');
}
$this->taskId = (int)$taskId;
$this->batchSize = (int)$batchSize;
$this->scheduledTaskSubscribersRepository = ContainerWrapper::getInstance()->get(ScheduledTaskSubscribersRepository::class);
}
public function rewind(): void {
$this->lastProcessedId = 0;
}
/**
* @return mixed - it's required for PHP8.1 to prevent using ReturnTypeWillChange that cause an error in PHPStan with PHP7
*/
#[\ReturnTypeWillChange]
public function current() {
$subscribers = $this->scheduledTaskSubscribersRepository->getSubscriberIdsBatchForTask($this->taskId, $this->lastProcessedId, $this->batchSize);
$this->batchLastId = end($subscribers);
return $subscribers;
}
/**
* @return string|float|int|bool|null - it's required for PHP8.1 to prevent using ReturnTypeWillChange that cause an error in PHPStan with PHP7
*/
#[\ReturnTypeWillChange]
public function key() {
return null;
}
public function next(): void {
$this->lastProcessedId = $this->batchLastId;
}
public function valid(): bool {
return $this->count() > 0;
}
public function count(): int {
return $this->scheduledTaskSubscribersRepository->countSubscriberIdsBatchForTask($this->taskId, $this->lastProcessedId);
}
}