add the line methods

This commit is contained in:
yggverse 2024-04-10 17:33:58 +03:00
parent 526d810406
commit fc3b82a052
2 changed files with 17 additions and 5 deletions

View file

@ -10,12 +10,22 @@ class Body
public function __construct(string $gemtext)
{
foreach ((array) explode(PHP_EOL, $gemtext) as $line)
foreach ((array) explode(PHP_EOL, $gemtext) as $index => $line)
{
$this->_lines[] = $line;
$this->_lines[$index] = $line;
}
}
public function getLine(int $index): ?int
{
return isset($this->_lines[$index]) ? $this->_lines[$index] : null;
}
public function getLines(): array
{
return $this->_lines;
}
public function getH1(): array
{
$matches = [];