| @@ 81-92 (lines=12) @@ | ||
| 78 | * |
|
| 79 | * @return SecurityTxt |
|
| 80 | */ |
|
| 81 | public function addContacts(array $contacts): SecurityTxt |
|
| 82 | { |
|
| 83 | if (!$this->validContacts($contacts)) { |
|
| 84 | throw new Exception('Contacts must be well-formed e-mails and/or URLs.'); |
|
| 85 | } |
|
| 86 | ||
| 87 | foreach ($contacts as $contact) { |
|
| 88 | $this->contacts[$contact] = true; |
|
| 89 | } |
|
| 90 | ||
| 91 | return $this; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Validates a contact. |
|
| @@ 152-163 (lines=12) @@ | ||
| 149 | * |
|
| 150 | * @return SecurityTxt |
|
| 151 | */ |
|
| 152 | public function removeContacts(array $contacts): SecurityTxt |
|
| 153 | { |
|
| 154 | if (!$this->hasContacts($contacts)) { |
|
| 155 | throw new Exception('Cannot remove contacts that do not exist.'); |
|
| 156 | } |
|
| 157 | ||
| 158 | foreach ($contacts as $contact) { |
|
| 159 | unset($this->contacts[$contact]); |
|
| 160 | } |
|
| 161 | ||
| 162 | return $this; |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * Determines if a contact exists. |
|