ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
UnzipOptions.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26final class UnzipOptions extends Options
27{
31 public const UNLIMITED = 0;
32
39
44 public const DEFAULT_RATIO_CHECK_MIN_UNCOMPRESSED_SIZE = 33554432; // 32 MiB
45
49 public const DEFAULT_MAX_AMOUNT_OF_ENTRIES = 100000;
50
58 public const DEFAULT_MAX_UNCOMPRESSED_SIZE = 4294967296; // 4 GiB
59
60 protected ?string $zip_output_path = null;
61 private bool $flat = false;
62 private bool $overwrite = false;
67
68 public function getZipOutputPath(): ?string
69 {
71 }
72
73 public function withZipOutputPath(string $zip_output_path): self
74 {
75 $clone = clone $this;
76 $clone->zip_output_path = $zip_output_path;
77 return $clone;
78 }
79
80 public function isOverwrite(): bool
81 {
82 return $this->overwrite;
83 }
84
85 public function withOverwrite(bool $overwrite): self
86 {
87 $clone = clone $this;
88 $clone->overwrite = $overwrite;
89 return $clone;
90 }
91
92 public function getMaxCompressionRatio(): int
93 {
95 }
96
98 {
99 $clone = clone $this;
100 $clone->max_compression_ratio = max(self::UNLIMITED, $max_compression_ratio);
101 return $clone;
102 }
103
105 {
107 }
108
110 {
111 $clone = clone $this;
112 $clone->ratio_check_min_uncompressed_size = max(0, $ratio_check_min_uncompressed_size);
113 return $clone;
114 }
115
116 public function getMaxAmountOfEntries(): int
117 {
119 }
120
122 {
123 $clone = clone $this;
124 $clone->max_amount_of_entries = max(self::UNLIMITED, $max_amount_of_entries);
125 return $clone;
126 }
127
128 public function getMaxUncompressedSize(): int
129 {
131 }
132
134 {
135 $clone = clone $this;
136 $clone->max_uncompressed_size = max(self::UNLIMITED, $max_uncompressed_size);
137 return $clone;
138 }
139
140}
withMaxAmountOfEntries(int $max_amount_of_entries)
withMaxUncompressedSize(int $max_uncompressed_size)
const DEFAULT_RATIO_CHECK_MIN_UNCOMPRESSED_SIZE
@description The ratio check is only applied once the total uncompressed size exceeds this floor,...
const DEFAULT_MAX_COMPRESSION_RATIO
@description Reject archives whose overall uncompressed/compressed ratio exceeds this value.
withZipOutputPath(string $zip_output_path)
const DEFAULT_MAX_UNCOMPRESSED_SIZE
@description Reject archives whose total uncompressed size exceeds this value.
const UNLIMITED
@description Disables a numeric limit (ratio, entry-count or size).
withMaxCompressionRatio(int $max_compression_ratio)
withRatioCheckMinUncompressedSize(int $ratio_check_min_uncompressed_size)
const DEFAULT_MAX_AMOUNT_OF_ENTRIES
@description Reject archives with more than this many entries (entry-count bomb).