Created
September 27, 2015 15:20
-
-
Save gnugat/9b6f85f0637dd5e949de to your computer and use it in GitHub Desktop.
An example of a Command (from CommandBus), with default values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Assert\Assertion; | |
class RegisterNewMember | |
{ | |
public $email; | |
public $subscribeToNewsletter = true; | |
public function __construct($email, $subscribeToNewsletter = null) | |
{ | |
Assertion::email(email); | |
$this->email = (string) $email; | |
if (false === $subscribeToNewsletter) { | |
$this->subscribeToNewsletter = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment