summaryrefslogtreecommitdiffstats
path: root/lib/Model/ActivityPub/Item.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Model/ActivityPub/Item.php')
-rw-r--r--lib/Model/ActivityPub/Item.php36
1 files changed, 34 insertions, 2 deletions
diff --git a/lib/Model/ActivityPub/Item.php b/lib/Model/ActivityPub/Item.php
index 8184ce1c..f1438583 100644
--- a/lib/Model/ActivityPub/Item.php
+++ b/lib/Model/ActivityPub/Item.php
@@ -261,7 +261,7 @@ class Item {
/**
* @return bool
*/
- public function gotActor(): bool {
+ public function hasActor(): bool {
if ($this->actor === null) {
return false;
}
@@ -394,13 +394,45 @@ class Item {
}
+ /**
+ * @param string $cc
+ *
+ * @return Item
+ */
public function addCc(string $cc): Item {
- $this->cc[] = $cc;
+ if (!$this->hasCc($cc)) {
+ $this->cc[] = $cc;
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param string $cc
+ *
+ * @return Item
+ */
+ public function removeCc(string $cc): Item {
+ if (!in_array($cc, $this->cc)) {
+ return $this;
+ }
+
+ $this->cc = array_diff($this->cc, [$cc]);
return $this;
}
/**
+ * @param string $cc
+ *
+ * @return bool
+ */
+ public function hasCc(string $cc): bool {
+ return (in_array($cc, $this->cc));
+ }
+
+
+ /**
* @return array
*/
public function getCcArray(): array {