Rename Model\User::getOwnerDataById parameter to better reflect intent

This commit is contained in:
Hypolite Petovan 2020-12-15 09:41:10 -05:00
parent e4228c6218
commit 8c17a6b4d9

View file

@ -370,12 +370,12 @@ class User
/** /**
* Get owner data by user id * Get owner data by user id
* *
* @param int $uid * @param int $uid
* @param boolean $check_valid Test if data is invalid and correct it * @param boolean $repairMissing Repair the owner data if it's missing
* @return boolean|array * @return boolean|array
* @throws Exception * @throws Exception
*/ */
public static function getOwnerDataById(int $uid, bool $check_valid = true) public static function getOwnerDataById(int $uid, bool $repairMissing = true)
{ {
if ($uid == 0) { if ($uid == 0) {
return self::getSystemAccount(); return self::getSystemAccount();
@ -387,7 +387,7 @@ class User
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]); $owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
if (!DBA::isResult($owner)) { if (!DBA::isResult($owner)) {
if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) { if (!DBA::exists('user', ['uid' => $uid]) || !$repairMissing) {
return false; return false;
} }
Contact::createSelfFromUserId($uid); Contact::createSelfFromUserId($uid);
@ -398,7 +398,7 @@ class User
return false; return false;
} }
if (!$check_valid) { if (!$repairMissing) {
return $owner; return $owner;
} }