1: <?php
2: declare(strict_types=1);
3:
4: namespace om\ICal\Parser;
5:
6: /**
7: * Limits for untrusted input; exceeding one throws ResourceLimitException.
8: */
9: final readonly class ParseLimits {
10: public function __construct(
11: public int $maxFileSize = 100 * 1024 * 1024,
12: public int $maxLineLength = 1024 * 1024,
13: public int $maxComponents = 1_000_000,
14: public int $maxProperties = 10_000_000,
15: public int $maxNestingDepth = 32,
16: ) {
17: }
18:
19: public static function unlimited(): self {
20: return new self(PHP_INT_MAX, PHP_INT_MAX, PHP_INT_MAX, PHP_INT_MAX, PHP_INT_MAX);
21: }
22: }
23: