mode = $data['mode']; } foreach ([ 'maxSourceSize' => 'maximum source size', 'timeoutSeconds' => 'timeout', 'retryDelaySeconds' => 'retry delay', ] as $property => $label) { if (!array_key_exists($property, $data)) { continue; } if (!is_int($data[$property]) || $data[$property] < 1) { throw new InvalidArgumentException("Preview {$label} must be a positive integer"); } $this->$property = $data[$property]; } return $this; } public function mode(): string { return $this->mode; } public function maxSourceSize(): int { return $this->maxSourceSize; } public function timeoutSeconds(): int { return $this->timeoutSeconds; } public function retryDelaySeconds(): int { return $this->retryDelaySeconds; } }