Filters
3 days ago
Scanning
3 days ago
AbstractFileObject.php
3 days ago
AbstractFilesystemScanner.php
3 days ago
DebugLogReader.php
3 days ago
DirectoryListing.php
3 days ago
DirectorySize.php
3 days ago
DiskWriteCheck.php
3 days ago
FileObject.php
3 days ago
Filesystem.php
3 days ago
FilesystemExceptions.php
5 years ago
FilesystemScanner.php
3 days ago
FilesystemScannerDto.php
3 days ago
FilterableDirectoryIterator.php
3 days ago
LegacyFileRulesTrait.php
3 days ago
LogCleanup.php
3 days ago
LogFiles.php
3 days ago
MissingFileException.php
3 years ago
OPcache.php
3 days ago
PartIdentifier.php
3 days ago
PathChecker.php
3 days ago
PathIdentifier.php
3 days ago
Permissions.php
3 days ago
WpUploadsFolderSymlinker.php
3 days ago
FilesystemScannerDto.php
201 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPStaging\Framework\Filesystem; |
| 4 | |
| 5 | class FilesystemScannerDto |
| 6 | { |
| 7 | |
| 8 | private $totalDirectories = 0; |
| 9 | |
| 10 | |
| 11 | private $filesystemSize = 0; |
| 12 | |
| 13 | |
| 14 | private $discoveredFiles = 0; |
| 15 | |
| 16 | |
| 17 | private $discoveredFilesArray = []; |
| 18 | |
| 19 | |
| 20 | private $isExcludingLogs = false; |
| 21 | |
| 22 | |
| 23 | private $isExcludingCaches = false; |
| 24 | |
| 25 | |
| 26 | private $excludedDirectories = []; |
| 27 | |
| 28 | |
| 29 | private $filesExcludedInRequest = []; |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | public function setTotalDirectories(int $totalDirectories) |
| 36 | { |
| 37 | $this->totalDirectories = $totalDirectories; |
| 38 | } |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | public function setFilesystemSize(int $filesystemSize) |
| 45 | { |
| 46 | $this->filesystemSize = $filesystemSize; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | public function setDiscoveredFiles(int $discoveredFiles) |
| 54 | { |
| 55 | $this->discoveredFiles = $discoveredFiles; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | public function setDiscoveredFilesArray(array $discoveredFilesArray) |
| 63 | { |
| 64 | $this->discoveredFilesArray = $discoveredFilesArray; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | public function setIsExcludingLogs(bool $isExcludingLogs) |
| 72 | { |
| 73 | $this->isExcludingLogs = $isExcludingLogs; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | public function setIsExcludingCaches(bool $isExcludingCaches) |
| 81 | { |
| 82 | $this->isExcludingCaches = $isExcludingCaches; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | public function setExcludedDirectories(array $excludedDirectories) |
| 90 | { |
| 91 | $this->excludedDirectories = $excludedDirectories; |
| 92 | } |
| 93 | |
| 94 | public function getTotalDirectories(): int |
| 95 | { |
| 96 | return $this->totalDirectories; |
| 97 | } |
| 98 | |
| 99 | public function getFilesystemSize(): int |
| 100 | { |
| 101 | return $this->filesystemSize; |
| 102 | } |
| 103 | |
| 104 | public function getDiscoveredFiles(): int |
| 105 | { |
| 106 | return $this->discoveredFiles; |
| 107 | } |
| 108 | |
| 109 | public function getDiscoveredFilesArray(): array |
| 110 | { |
| 111 | return $this->discoveredFilesArray; |
| 112 | } |
| 113 | |
| 114 | public function getIsExcludingLogs(): bool |
| 115 | { |
| 116 | return $this->isExcludingLogs; |
| 117 | } |
| 118 | |
| 119 | public function getIsExcludingCaches(): bool |
| 120 | { |
| 121 | return $this->isExcludingCaches; |
| 122 | } |
| 123 | |
| 124 | public function getExcludedDirectories(): array |
| 125 | { |
| 126 | return $this->excludedDirectories; |
| 127 | } |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | public function setDiscoveredFilesByCategory(string $category, int $count) |
| 135 | { |
| 136 | $this->discoveredFilesArray[$category] = $count; |
| 137 | } |
| 138 | |
| 139 | public function getDiscoveredFilesByCategory(string $category): int |
| 140 | { |
| 141 | return $this->discoveredFilesArray[$category] ?? 0; |
| 142 | } |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | public function incrementDiscoveredFiles() |
| 148 | { |
| 149 | $this->discoveredFiles++; |
| 150 | } |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | public function incrementTotalDirectories() |
| 156 | { |
| 157 | $this->totalDirectories++; |
| 158 | } |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | public function incrementDiscoveredFilesByCategory(string $category) |
| 165 | { |
| 166 | $this->discoveredFilesArray[$category] = ($this->discoveredFilesArray[$category] ?? 0) + 1; |
| 167 | } |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | public function addFilesystemSize(int $size) |
| 174 | { |
| 175 | $this->filesystemSize += $size; |
| 176 | } |
| 177 | |
| 178 | public function getFilesExcludedInRequest(): array |
| 179 | { |
| 180 | return $this->filesExcludedInRequest; |
| 181 | } |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | public function setFilesExcludedInRequest(array $filesExcludedInRequest) |
| 188 | { |
| 189 | $this->filesExcludedInRequest = $filesExcludedInRequest; |
| 190 | } |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | public function addFileExcludedInRequest(string $filePath) |
| 197 | { |
| 198 | $this->filesExcludedInRequest[] = $filePath; |
| 199 | } |
| 200 | } |
| 201 |