Advertisement
Guest User

Untitled

a guest
May 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. namespace ValueObjectTest;
  6.  
  7. use Sushi\ValueObject;
  8.  
  9. class PersonValueObject extends ValueObject
  10. {
  11. const KEY_FIRSTNAME = 'firstname';
  12. const KEY_LASTNAME = 'lastname';
  13. const KEY_CITY = 'city';
  14. const KEY_OCCUPATION = 'occupation';
  15.  
  16. protected $keys = [
  17. self::KEY_FIRSTNAME,
  18. self::KEY_LASTNAME,
  19. self::KEY_CITY,
  20. self::KEY_OCCUPATION,
  21. ];
  22.  
  23. public static function create(
  24. string $firstname,
  25. string $lastname,
  26. string $city,
  27. string $occupation
  28. ): self {
  29. return new static([
  30. static::KEY_FIRSTNAME => $firstname,
  31. static::KEY_LASTNAME => $lastname,
  32. static::KEY_CITY => $city,
  33. static::KEY_OCCUPATION => $occupation,
  34. ]);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement