add getQuote method

This commit is contained in:
yggverse 2024-04-12 09:45:23 +03:00
parent 284733886e
commit 1b996e043b
2 changed files with 18 additions and 0 deletions

View File

@ -128,6 +128,7 @@ $body = new \Yggverse\Gemini\Gemtext\Body(
#### Body::getH1 #### Body::getH1
#### Body::getH2 #### Body::getH2
#### Body::getH3 #### Body::getH3
#### Body::getQuote
#### Body::getLinks #### Body::getLinks
``` php ``` php

View File

@ -94,6 +94,23 @@ class Body
return $matches; return $matches;
} }
public function getQuote(): array
{
$matches = [];
foreach ($this->_lines as $index => $line)
{
if (preg_match('/^>(.*)/', trim($line), $match))
{
$matches[$index] = trim(
$match[1]
);
}
}
return $matches;
}
public function findLinks(string $protocol = 'gemini'): array public function findLinks(string $protocol = 'gemini'): array
{ {
$matches = []; $matches = [];