SHARE
TWEET

Untitled

a guest May 21st, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top