Jake Vanderwerf
2026-01-20 7a9054bb3f033c98067b3196378311dae54c5fbf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace JVBase\managers\queue;
if (!defined('ABSPATH')) {
    exit;
}
//Progress.php
final class Progress
{
    private Operation $operation;
 
    public function __construct(Operation $op)
    {
        $this->operation = $op;
    }
 
    public function advance(int $count = 1): void
    {
        $this->operation->processedItems = min(
            $this->operation->processedItems + $count,
            $this->operation->totalItems
        );
    }
 
    public function failItem(mixed $item, string $reason): void
    {
        $this->operation->failedItems[] = [
            'item' => $item,
            'reason' => $reason,
        ];
    }
}