Skip to content

Commit

Permalink
Update UserInfo.php
Browse files Browse the repository at this point in the history
deal with static method calls
  • Loading branch information
wordish authored Aug 9, 2024
1 parent e9f3938 commit 9b1278f
Showing 1 changed file with 49 additions and 21 deletions.
70 changes: 49 additions & 21 deletions concrete/src/User/UserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,65 +1111,93 @@ protected function getDirector()
}

/**
* @deprecated Use app()->make('user/registration')->create()
* @deprecated Use $app->make('user/registration')->create()
*/
public static function add($data)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make('user/registration')->create($data);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make('user/registration')->create($data);
}

/**
* @deprecated Use app()->make('user/registration')->createSuperUser()
* @deprecated Use $app->make('user/registration')->createSuperUser()
*/
public static function addSuperUser($uPasswordEncrypted, $uEmail)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make('user/registration')->createSuperUser($uPasswordEncrypted, $uEmail);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make('user/registration')->createSuperUser($uPasswordEncrypted, $uEmail);
}

/**
* @deprecated Use app()->make('user/registration')->createFromPublicRegistration()
* @deprecated Use $app->make('user/registration')->createFromPublicRegistration()
*/
public static function register($data)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make('user/registration')->createFromPublicRegistration($data);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make('user/registration')->createFromPublicRegistration($data);
}

/**
* @deprecated use app()->make(\Concrete\Core\User\UserInfoRepository::class)->getByID()
* @deprecated use $app->make(\Concrete\Core\User\UserInfoRepository::class)->getByID()
*/
public static function getByID($uID)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make(UserInfoRepository::class)->getByID($uID);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make(UserInfoRepository::class)->getByID($uID);
}

/**
* @deprecated use app()->make(\Concrete\Core\User\UserInfoRepository::class)->getByName()
* @deprecated use $app->make(\Concrete\Core\User\UserInfoRepository::class)->getByName()
*/
public static function getByUserName($uName)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make(UserInfoRepository::class)->getByName($uName);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make(UserInfoRepository::class)->getByName($uName);
}

/**
* @deprecated use app()->make(\Concrete\Core\User\UserInfoRepository::class)->getByEmail()
* @deprecated use $app->make(\Concrete\Core\User\UserInfoRepository::class)->getByEmail()
*/
public static function getByEmail($uEmail)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make(UserInfoRepository::class)->getByEmail($uEmail);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make(UserInfoRepository::class)->getByEmail($uEmail);
}

/**
* @deprecated use app()->make(\Concrete\Core\User\UserInfoRepository::class)->getByValidationHash()
* @deprecated use $app->make(\Concrete\Core\User\UserInfoRepository::class)->getByValidationHash()
*/
public static function getByValidationHash($uHash, $unredeemedHashesOnly = true)
{
$this->application ??= Facade::getFacadeApplication();
return $this->application->make(UserInfoRepository::class)->getByValidationHash($uHash, $unredeemedHashesOnly);
if (isset($this) && get_class($this) == __CLASS__) {
$app = $this->application
} else {
$app = Facade::getFacadeApplication();
}
return $app->make(UserInfoRepository::class)->getByValidationHash($uHash, $unredeemedHashesOnly);
}
}

0 comments on commit 9b1278f

Please sign in to comment.