mirror of
https://github.com/YGGverse/gemini-php.git
synced 2026-04-01 09:25:29 +00:00
add getQuote method
This commit is contained in:
parent
284733886e
commit
1b996e043b
2 changed files with 18 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue