Inheritance: extends Exception
 public static function checkPhoneNumber($string)
 {
     if (!starts_with($string, '+')) {
         throw CouldNotCreateMessage::invalidPhoneNumber();
     }
     return $string;
 }
 public function toArray()
 {
     $this->checkRecipient();
     if (is_null($this->sticker)) {
         throw CouldNotCreateMessage::noStickerDefined();
     }
     return ['recipient' => ['id' => $this->recipient_id], 'sticker_id' => $this->sticker];
 }
 public function toArray()
 {
     $this->checkRecipient();
     if (is_null($this->action)) {
         throw CouldNotCreateMessage::noActionDefined();
     }
     return ['recipient' => ['id' => $this->recipient_id], 'sender_action' => $this->action];
     //return array
     //check null action
 }
 public function toArray()
 {
     $this->checkRecipient();
     if (is_null($this->attachment_type)) {
         throw CouldNotCreateMessage::noAttachmentType();
     }
     if (is_null($this->attachment_url) && is_null($this->attachment_id)) {
         throw CouldNotCreateMessage::noAttachmentUrl();
     }
     $payload = ['url' => $this->attachment_url];
     if ($this->is_reuseable) {
         $payload['is_reuseable'] = true;
     }
     if (!is_null($this->attachment_id)) {
         $payload = ['attachment_id' => $this->attachment_id];
     }
     return ['recipient' => ['id' => $this->recipient_id], 'message' => ['attachment' => ['type' => $this->attachment_type, 'payload' => $payload]]];
 }
 public function checkRecipient()
 {
     if (!isset($this->recipient_id)) {
         throw CouldNotCreateMessage::noRecipientDefined();
     }
 }