/** * {@inheritdoc} */ public static function fromArray(array $values) { $message = new self(); $values = array_merge(['tutorials_completed' => [], 'send_marketing_emails' => null, 'send_push_notifications' => null], $values); $message->setSendMarketingEmails($values['send_marketing_emails']); $message->setSendPushNotifications($values['send_push_notifications']); foreach ($values['tutorials_completed'] as $item) { $message->addTutorialsCompleted($item); } return $message; }