diff options
Diffstat (limited to 'src/DTS/BookmarkRepository.php')
| -rw-r--r-- | src/DTS/BookmarkRepository.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/DTS/BookmarkRepository.php b/src/DTS/BookmarkRepository.php index 01f6de4..fde8510 100644 --- a/src/DTS/BookmarkRepository.php +++ b/src/DTS/BookmarkRepository.php @@ -12,6 +12,8 @@ class BookmarkRepository implements \Iterator private array $repository = []; + private array $tags = []; + private int $position = 0; function __construct(string $pathToRepository) @@ -75,6 +77,11 @@ class BookmarkRepository implements \Iterator return false; } + public function tags(): array + { + return $this->tags; + } + public function current(): mixed { return $this->repository[$this->position]; @@ -122,8 +129,14 @@ class BookmarkRepository implements \Iterator $bookmark->addedAt = $data[3]; $this->repository[] = $bookmark; + + $this->tags[] = $bookmark->tag; } + $this->tags = array_filter(array_unique($this->tags)); + + sort($this->tags); + fclose($fp); } |
