diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Recipient/Contact.php | 35 | ||||
-rw-r--r-- | src/Recipient/Group.php | 10 |
2 files changed, 27 insertions, 18 deletions
diff --git a/src/Recipient/Contact.php b/src/Recipient/Contact.php index 3fd5c3d..b9c5dba 100644 --- a/src/Recipient/Contact.php +++ b/src/Recipient/Contact.php @@ -116,65 +116,72 @@ class Contact implements ProcessableComponentInterface } /** * @param string $firstName Sets the first name of the contact. - * @return void + * @return self */ - public function setFirstName(string $firstName) :void + public function setFirstName(string $firstName): self { $this->firstName = $firstName; + return $this; } /** * @param ?string $lastName Sets the last name of the contact. - * @return void + * @return self */ - public function setLastName(?string $lastName): void + public function setLastName(?string $lastName): self { $this->lastName = $lastName; + return $this; } /** * @param string $phoneNumber Sets the phone number of the contact. - * @return void + * @return self */ - public function setPhoneNumber(string $phoneNumber): void + public function setPhoneNumber(string $phoneNumber): self { $this->phone = $phoneNumber; + return $this; } /** * @param ?string $title Sets the title of the contact. - * @return void + * @return self */ - public function setTitle(?string $title): void + public function setTitle(?string $title): self { $this->title = $title; + return $this; } /** * @param ?string $organization Sets the contact company or other organization the contact belongs to. - * @return void + * @return self */ - public function setOrganization(?string $organization): void + public function setOrganization(?string $organization): self { $this->organization = $organization; + return $this; } /** * @param ?string $email Sets the email adress of the contact. - * @return void + * @return self */ - public function setEmail(?string $email): void + public function setEmail(?string $email): self { $this->email = $email; + return $this; } /** * @param ?string $notes Sets the notes of the contact. - * @return void + * @return self */ - public function setNotes(?string $notes): void + public function setNotes(?string $notes): self { $this->notes = $notes; + return $this; } /** * @return string The contacts first name. diff --git a/src/Recipient/Group.php b/src/Recipient/Group.php index 0a5de89..474f270 100644 --- a/src/Recipient/Group.php +++ b/src/Recipient/Group.php @@ -64,29 +64,31 @@ class Group implements ProcessableComponentInterface /** * Sets the Group's name to the given string. * @param string $name Name that the Group should have. + * @return self * @throws \InvalidArgumentException When $name is empty. - * @return void */ - public function setName(string $name):void + public function setName(string $name): self { if (empty($name)) { throw new \InvalidArgumentException("Group name can not be empty"); } $this->name = $name; + return $this; } /** * Sets the groups color. * @param string $color A hexadecimal color code. * @example #5E5E5E - * @return void + * @return self * @throws \InvalidArgumentException When $color isn't a valid hexadecimal color. */ - public function setColor(string $color): void + public function setColor(string $color): self { if (!preg_match("/^#([A-Fa-f0-9]{6})$/", $color)) { throw new \InvalidArgumentException($color. " is not a valid hexadecimal color"); } $this->color = $color; + return $this; } /** * Serializes the object to a value that can be serialized natively by json_encode(). |