public static function consume()

in src/inlines/HardLineBreak.php [25:49]


  public static function consume(
    Context $_,
    string $markdown,
    int $offset,
  ): ?(Inline, int) {
    if (Str\slice($markdown, $offset, 2) === "\\\n") {
      return tuple(new self(), $offset + 2);
    }

    $len = Str\length($markdown);
    for ($i = $offset; $i < $len; ++$i) {
      if ($markdown[$i] === ' ') {
        continue;
      }
      if ($markdown[$i] === "\n") {
        if ($i - $offset < 2) {
          return null;
        }

        return tuple(new self(), $i + 1);
      }
      return null;
    }
    return null;
  }