dolibarr 25.0.0-alpha
SyncReport.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2026 ATM Consulting <support@atm-consulting.fr>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
31final class SyncReport
32{
34 public $updatedLines;
35
37 public $skipped;
38
40 public $conflicts;
41
43 public $warnings;
44
51 public function __construct(int $updatedLines = 0, int $skipped = 0, array $conflicts = array(), array $warnings = array())
52 {
53 $this->updatedLines = $updatedLines;
54 $this->skipped = $skipped;
55 $this->conflicts = $conflicts;
56 $this->warnings = $warnings;
57 }
58
64 public function hasConflicts(): bool
65 {
66 return !empty($this->conflicts);
67 }
68
74 public function hasWarnings(): bool
75 {
76 return !empty($this->warnings);
77 }
78
87 public function isNoop(): bool
88 {
89 return $this->updatedLines === 0;
90 }
91
97 public function toLegacyReturnCode(): int
98 {
99 return $this->hasConflicts() ? -1 : 1;
100 }
101}
Immutable outcome of a permissions sync run.
toLegacyReturnCode()
Map the report onto the historical reWriteAllPermissions() return code.
hasWarnings()
Whether something was normalized while still writing.
hasConflicts()
Whether a blocking problem prevented the write.
__construct(int $updatedLines=0, int $skipped=0, array $conflicts=array(), array $warnings=array())
isNoop()
Whether the sync produced no permission line.