Browse Source

add getQuote method

main
yggverse 7 months ago
parent
commit
1b996e043b
  1. 1
      README.md
  2. 17
      src/Gemtext/Body.php

1
README.md

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

17
src/Gemtext/Body.php

@ -94,6 +94,23 @@ class Body @@ -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…
Cancel
Save