support tags in invoices (#2526)

This commit is contained in:
Kevin Papst
2021-04-23 17:06:42 +02:00
committed by GitHub
parent 67d23ec6b2
commit bb94b11e37
9 changed files with 59 additions and 5 deletions

View File

@@ -75,6 +75,10 @@ final class InvoiceItem
* @var string
*/
private $category;
/**
* @var string[]
*/
private $tags = [];
public function addAdditionalField(string $name, ?string $value): InvoiceItem
{
@@ -269,4 +273,23 @@ final class InvoiceItem
return $this;
}
public function addTag(string $tag): void
{
foreach ($this->tags as $t) {
if (strcasecmp($tag, $t) === 0) {
return;
}
}
$this->tags[] = $tag;
}
/**
* @return string[]
*/
public function getTags(): array
{
return $this->tags;
}
}