mirror of
https://github.com/YGGverse/gemtext-php.git
synced 2026-03-31 17:55:38 +00:00
implement entity getters
This commit is contained in:
parent
882f2aee2e
commit
a9ecaace57
1 changed files with 60 additions and 0 deletions
|
|
@ -95,6 +95,66 @@ class Document
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHeaders(): array
|
||||||
|
{
|
||||||
|
$headers = [];
|
||||||
|
|
||||||
|
foreach ($this->_entity as $entity)
|
||||||
|
{
|
||||||
|
if ($entity instanceof Entity\Header)
|
||||||
|
{
|
||||||
|
$headers[] = $entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLinks(): array
|
||||||
|
{
|
||||||
|
$links = [];
|
||||||
|
|
||||||
|
foreach ($this->_entity as $entity)
|
||||||
|
{
|
||||||
|
if ($entity instanceof Entity\Link)
|
||||||
|
{
|
||||||
|
$links[] = $entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getListings(): array
|
||||||
|
{
|
||||||
|
$listings = [];
|
||||||
|
|
||||||
|
foreach ($this->_entity as $entity)
|
||||||
|
{
|
||||||
|
if ($entity instanceof Entity\Listing)
|
||||||
|
{
|
||||||
|
$listings[] = $entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $listings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQuotes(): array
|
||||||
|
{
|
||||||
|
$quotes = [];
|
||||||
|
|
||||||
|
foreach ($this->_entity as $entity)
|
||||||
|
{
|
||||||
|
if ($entity instanceof Entity\Quote)
|
||||||
|
{
|
||||||
|
$quotes[] = $entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $quotes;
|
||||||
|
}
|
||||||
|
|
||||||
public function toString(): string
|
public function toString(): string
|
||||||
{
|
{
|
||||||
$lines = [];
|
$lines = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue