PluginProbe
Auto Alt Text / 2.7.0
Auto Alt Text v2.7.0
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / src / App / Admin / BulkActions / BulkActionResult.php

BulkActionResult.php in Auto Alt Text 2.7.0, at src/App/Admin/BulkActions/BulkActionResult.php

89 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AATXT\App\Admin\BulkActions;
4
5 /**
6 * Value Object representing the result of a bulk action.
7 *
8 * Immutable object that holds the counts of total items processed
9 * and successfully updated items.
10 */
11 final class BulkActionResult
12 {
13 /**
14 * Total number of items that were processed
15 *
16 * @var int
17 */
18 private $total;
19
20 /**
21 * Number of items successfully updated
22 *
23 * @var int
24 */
25 private $updated;
26
27 /**
28 * Constructor
29 *
30 * @param int $total Total items processed
31 * @param int $updated Items successfully updated
32 */
33 public function __construct(int $total, int $updated)
34 {
35 $this->total = $total;
36 $this->updated = $updated;
37 }
38
39 /**
40 * Get the total number of items processed.
41 *
42 * @return int
43 */
44 public function getTotal(): int
45 {
46 return $this->total;
47 }
48
49 /**
50 * Get the number of items successfully updated.
51 *
52 * @return int
53 */
54 public function getUpdated(): int
55 {
56 return $this->updated;
57 }
58
59 /**
60 * Check if all items were successfully updated.
61 *
62 * @return bool
63 */
64 public function isComplete(): bool
65 {
66 return $this->total === $this->updated;
67 }
68
69 /**
70 * Check if no items were updated.
71 *
72 * @return bool
73 */
74 public function hasNoUpdates(): bool
75 {
76 return $this->updated === 0;
77 }
78
79 /**
80 * Check if some but not all items were updated.
81 *
82 * @return bool
83 */
84 public function isPartial(): bool
85 {
86 return $this->updated > 0 && $this->updated < $this->total;
87 }
88 }
89