public static function noActionDefined()
{
return new static('You must define an Action');
}
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 }