mirror of
https://github.com/YGGverse/gemini-php.git
synced 2025-03-13 06:01:58 +00:00
add getQuote method
This commit is contained in:
parent
284733886e
commit
1b996e043b
@ -128,6 +128,7 @@ $body = new \Yggverse\Gemini\Gemtext\Body(
|
||||
#### Body::getH1
|
||||
#### Body::getH2
|
||||
#### Body::getH3
|
||||
#### Body::getQuote
|
||||
#### Body::getLinks
|
||||
|
||||
``` php
|
||||
|
@ -94,6 +94,23 @@ class Body
|
||||
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
|
||||
{
|
||||
$matches = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user