$channels * @param bool $inTermNote 这段内容是某个术语的 note:里面的术语不再取它们自己的 note(只展开一层,v2 口径) */ public function __construct( public array $channels = [], public Dialect $dialect = Dialect::Markdown, public int $depth = 1, public string $channelType = 'translation', public string $contentType = 'markdown', public bool $inTermNote = false, ) {} public function firstChannel(): ?string { return $this->channels[0] ?? null; } /** * 下一层内容的 Scope。 * * @param list|null $channels null 表示沿用当前 channel */ public function nested(?array $channels = null, ?string $contentType = null, string $channelType = 'translation'): self { $contentType ??= 'markdown'; return new self( channels: $channels ?? $this->channels, dialect: Dialect::fromContentType($contentType), depth: $this->depth + 1, channelType: $channelType, contentType: $contentType, ); } public function canNest(): bool { return $this->depth < self::MAX_DEPTH; } }