$value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } } public static function fromByAuthService(AuthService $service): self { return new self( [ 'isLogin' => $service->isLoggedIn(), 'uid' => $service->getUID(), 'name' => $service->getName(), 'role' => $service->getRole(), ] ); } }