Skip to content

Instantly share code, notes, and snippets.

@ismail1432
Last active September 10, 2023 23:11
Show Gist options
  • Save ismail1432/dbe4e2a77da03fcb80e2bc792b2f5306 to your computer and use it in GitHub Desktop.
Save ismail1432/dbe4e2a77da03fcb80e2bc792b2f5306 to your computer and use it in GitHub Desktop.
<?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;
}
}
@hbgamra
Copy link

hbgamra commented Sep 8, 2023

public function create(string $name, int $age): self : is not a static function but it's called as static function in execute() function in CreateAUserHandler.php class

@ismail1432
Copy link
Author

public function create(string $name, int $age): self : is not a static function but it's called as static function in execute() function in CreateAUserHandler.php class

Bien Vu merci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment