Last active
September 10, 2023 23:11
-
-
Save ismail1432/dbe4e2a77da03fcb80e2bc792b2f5306 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
namespace App\Domain; | |
use Symfony\Component\Uid\Uuid; | |
final class User | |
{ | |
private UserId $userId; | |
private string $name; | |
private string $age; | |
private function __construct() | |
{ | |
} | |
public static function create(string $name, int $age): self | |
{ | |
$user = new self(); | |
$user->userId = Uuid::v4()->__toString(); | |
$user->name = $name; | |
$user->age = $age; | |
return $user; | |
} | |
public function getUserId(): UserId | |
{ | |
return $this->userId; | |
} | |
public function getName(): string | |
{ | |
return $this->name; | |
} | |
public function getAge(): string | |
{ | |
return $this->age; | |
} | |
} |
public function create(string $name, int $age): self :
is not astatic
function but it's called asstatic
function inexecute()
function inCreateAUserHandler.php
class
Bien Vu merci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public function create(string $name, int $age): self :
is not astatic
function but it's called asstatic
function inexecute()
function inCreateAUserHandler.php
class