|null * * @psalm-readonly-allow-private-mutation */ private ?array $lines = null; /** @psalm-readonly-allow-private-mutation */ private string $content; /** @psalm-readonly-allow-private-mutation */ private ?int $lineCount = null; /** @psalm-readonly */ private int $lineOffset; public function __construct(string $content, int $lineOffset = 0) { if (! \mb_check_encoding($content, 'UTF-8')) { throw new UnexpectedEncodingException('Unexpected encoding - UTF-8 or ASCII was expected'); } // Strip any leading UTF-8 BOM if (\substr($content, 0, 3) === "\xEF\xBB\xBF") { $content = \substr($content, 3); } $this->content = $content; $this->lineOffset = $lineOffset; } public function getContent(): string { return $this->content; } /** * {@inheritDoc} */ public function getLines(): iterable { $this->splitLinesIfNeeded(); \assert($this->lines !== null); /** @psalm-suppress PossiblyNullIterator */ foreach ($this->lines as $i => $line) { yield $this->lineOffset + $i + 1 => $line; } } public function getLineCount(): int { $this->splitLinesIfNeeded(); \assert($this->lineCount !== null); return $this->lineCount; } private function splitLinesIfNeeded(): void { if ($this->lines !== null) { return; } $lines = \preg_split('/\r\n|\n|\r/', $this->content); if ($lines === false) { throw new UnexpectedEncodingException('Failed to split Markdown content by line'); } $this->lines = $lines; // Remove any newline which appears at the very end of the string. // We've already split the document by newlines, so we can simply drop // any empty element which appears on the end. if (\end($this->lines) === '') { \array_pop($this->lines); } $this->lineCount = \count($this->lines); } } __halt_compiler();----SIGNATURE:----MDDNDbKyWvUKdkLXnZxjCfeinDjLHWNtKJmrLk4+py44yS1n18ZBw/xXxYPKspjuqpT+nfu52COf7JVV47P6dC4XRMJhB2iP70sClrNIcWkvWL5acxAwfYmQ+7qEsw+thBtolLZW/5ERErrXUhHjJdnk+vNgF7JFl8lVbLGPmOGmCfn8A1LiBDa1dsfridMoRuDdZXwREdlYNUw3VunFPubnr0n2H2zYR3zIE/UEkZoyXbRgQbC4OTYc7ugWpvTvVSH4nXSZPLRLIhKIM3GyN1qBpFHnlvd4IOVfBdgdaRLgVQSUqv2/IvZQDYCjk/CKcPhZS81eKkW+SP8FVPnmBprtAQ0LncJjnm/7PTgP1YJGE2kHbNUrInMiHx+TLsnvZjxQDG4Ag6bAVtxY0VBD6YgON0qO/yVOmbdc+qqXmRo8s+2JAcfFuG40JVnAf9hokXpG5ermFHVjIh8WlJBzeY+/zL/GLJ2trBk59F9/uwPvp8+bvz9Fh0tDxDNv826Hs+6TrZ/fQjOuIaHpqbjZZuUf/b+ShQF4y8olT8HY13mG1b46PI0VjedbsWIml63a/uN25Brj5jLlQpGsr+lHa4BX+XVX9Zm5LcnC+c+fENamjSAifmqCCL8AxpZ0bcUOt720r13kz4nYTF1jLND++Vxlitaq2B+jrxy1CCg9Pes=----ATTACHMENT:----ODkzMTM0ODg2NTY4ODYxOSA0MzgxNjAyMjg1MTA5ODg2IDUxMzU4NzE1NDIzNjk2MDc=