Exemplo n.º 1
0
 private function setName($name)
 {
     if (!is_string($name) || empty($name)) {
         throw UserName::isNotValid();
     }
     $this->name = $name;
 }
Exemplo n.º 2
0
 /**
  * @param array $payload
  * @return RegisterUser
  * @throws Exception\UserName
  */
 public static function fromPayload(array $payload)
 {
     if (!isset($payload['name'])) {
         throw UserName::isMissing();
     }
     if (!isset($payload['email'])) {
         throw Exception\Email::isMissing();
     }
     return new self(__CLASS__, $payload);
 }