diff --git a/lib/SP/DataModel/AccountExtData.php b/lib/SP/DataModel/AccountExtData.php index 876e0d8f..3442ae89 100644 --- a/lib/SP/DataModel/AccountExtData.php +++ b/lib/SP/DataModel/AccountExtData.php @@ -33,176 +33,50 @@ use SP\Domain\Account\Out\AccountData; */ class AccountExtData extends AccountData { - /** - * @var array Los Ids de los usuarios secundarios de la cuenta. - */ - public $usersId = []; - /** - * @var array Los Ids de los grupos secundarios de la cuenta. - */ - public $userGroupsId = []; - /** - * @var array - */ - public $tags = []; - /** - * @var string - */ - public $categoryName = ''; - /** - * @var string - */ - public $clientName = ''; - /** - * @var string - */ - public $userGroupName = ''; - /** - * @var string - */ - public $userName = ''; - /** - * @var string - */ - public $userLogin = ''; - /** - * @var string - */ - public $userEditName = ''; - /** - * @var string - */ - public $userEditLogin = ''; - /** - * @var string - */ - public $publicLinkHash = ''; + protected array $usersId = []; + protected array $userGroupsId = []; + protected array $tags = []; + protected ?string $categoryName = null; + protected ?string $clientName = null; + protected ?string $userGroupName = null; + protected ?string $userName = null; + protected ?string $userLogin = null; + protected ?string $userEditName = null; + protected ?string $userEditLogin = null; + protected ?string $publicLinkHash = null; - /** - * @return string - */ - public function getUserEditName() + public function getUserEditName(): ?string { return $this->userEditName; } - /** - * @return string - */ - public function getUserEditLogin() + public function getUserEditLogin(): ?string { return $this->userEditLogin; } - /** - * @return string - */ - public function getPublicLinkHash() - { - return $this->publicLinkHash; - } - - /** - * @return array - */ - public function getAccountUsersId() - { - return $this->usersId; - } - - /** - * @return array - */ - public function getAccountUserGroupsId() - { - return $this->userGroupsId; - } - - /** - * @return array - */ - public function getTags() - { - return $this->tags; - } - - /** - * @param array $tags - */ - public function setTags(array $tags) - { - $this->tags = $tags; - } - - /** - * @return string - */ - public function getCategoryName() + public function getCategoryName(): ?string { return $this->categoryName; } - /** - * @return string - */ - public function getClientName() + public function getClientName(): ?string { return $this->clientName; } - /** - * @return string - */ - public function getUserGroupName() + public function getUserGroupName(): ?string { return $this->userGroupName; } - /** - * @return string - */ - public function getUserName() + public function getUserName(): ?string { return $this->userName; } - /** - * @return string - */ - public function getUserLogin() + public function getUserLogin(): ?string { return $this->userLogin; } - - /** - * @return array - */ - public function getUsersId() - { - return $this->usersId; - } - - /** - * @param array $usersId - */ - public function setUsersId(array $usersId) - { - $this->usersId = $usersId; - } - - /** - * @return array - */ - public function getUserGroupsId() - { - return $this->userGroupsId; - } - - /** - * @param array $userGroupsId - */ - public function setUserGroupsId(array $userGroupsId) - { - $this->userGroupsId = $userGroupsId; - } } \ No newline at end of file diff --git a/lib/SP/DataModel/AccountHistoryData.php b/lib/SP/DataModel/AccountHistoryData.php index c73b2704..050a2e62 100644 --- a/lib/SP/DataModel/AccountHistoryData.php +++ b/lib/SP/DataModel/AccountHistoryData.php @@ -4,7 +4,7 @@ * * @author nuxsmin * @link https://syspass.org - * @copyright 2012-2021, Rubén Domínguez nuxsmin@$syspass.org + * @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. * @@ -31,64 +31,12 @@ namespace SP\DataModel; */ class AccountHistoryData extends AccountExtData { - /** - * @var bool - */ - public $isModify = 0; - /** - * @var bool - */ - public $isDeleted = 0; - /** - * @var int - */ - public $accountId; + protected int $isModify = 0; + protected int $isDeleted = 0; + protected ?int $accountId = null; - /** - * @return int - */ - public function isIsModify() - { - return (int)$this->isModify; - } - - /** - * @param boolean $isModify - */ - public function setIsModify($isModify) - { - $this->isModify = (int)$isModify; - } - - /** - * @return int - */ - public function isIsDeleted() - { - return (int)$this->isDeleted; - } - - /** - * @param boolean $isDeleted - */ - public function setIsDeleted($isDeleted) - { - $this->isDeleted = (int)$isDeleted; - } - - /** - * @return int - */ - public function getAccountId() + public function getAccountId(): ?int { return $this->accountId; } - - /** - * @param int $accountId - */ - public function setAccountId($accountId) - { - $this->accountId = $accountId; - } } \ No newline at end of file diff --git a/lib/SP/Domain/Account/Out/AccountData.php b/lib/SP/Domain/Account/Out/AccountData.php index 58acbcab..9b398b1b 100644 --- a/lib/SP/Domain/Account/Out/AccountData.php +++ b/lib/SP/Domain/Account/Out/AccountData.php @@ -36,27 +36,27 @@ use SP\Http\Json; */ class AccountData extends DataModelBase implements JsonSerializable, DataModelInterface { - private int $id; - private ?int $userId = null; - private ?int $userGroupId = null; - private ?int $userEditId = null; - private ?string $name = null; - private ?int $clientId = null; - private ?int $categoryId = null; - private ?string $login = null; - private ?string $url = null; - private ?string $pass = null; - private ?string $key = null; - private ?string $notes = null; - private ?int $dateAdd = 0; - private ?int $dateEdit = 0; - private ?int $countView = 0; - private ?int $countDecrypt = 0; - private ?int $isPrivate = 0; - private ?int $isPrivateGroup = 0; - private ?int $passDate = 0; - private ?int $passDateChange = 0; - private ?int $parentId = 0; + protected int $id; + protected ?int $userId = null; + protected ?int $userGroupId = null; + protected ?int $userEditId = null; + protected ?string $name = null; + protected ?int $clientId = null; + protected ?int $categoryId = null; + protected ?string $login = null; + protected ?string $url = null; + protected ?string $pass = null; + protected ?string $key = null; + protected ?string $notes = null; + protected ?int $dateAdd = 0; + protected ?int $dateEdit = 0; + protected ?int $countView = 0; + protected ?int $countDecrypt = 0; + protected ?int $isPrivate = 0; + protected ?int $isPrivateGroup = 0; + protected ?int $passDate = 0; + protected ?int $passDateChange = 0; + protected ?int $parentId = 0; public function __construct(int $accountId = 0, ?array $properties = []) { @@ -153,7 +153,7 @@ class AccountData extends DataModelBase implements JsonSerializable, DataModelIn * which is a value of any type other than a resource. * @since 5.4.0 */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $data = get_object_vars($this); diff --git a/lib/SP/Domain/Common/Out/DataModelBase.php b/lib/SP/Domain/Common/Out/DataModelBase.php index ce0c5243..44d28e60 100644 --- a/lib/SP/Domain/Common/Out/DataModelBase.php +++ b/lib/SP/Domain/Common/Out/DataModelBase.php @@ -43,7 +43,7 @@ abstract class DataModelBase * * @return mixed|null */ - public function __get(string $name) + public final function __get(string $name) { if (property_exists($this, $name)) { return $this->{$name}; @@ -56,7 +56,7 @@ abstract class DataModelBase return null; } - public function __set(string $name, ?string $value = null): void + public final function __set(string $name, ?string $value = null): void { if (is_numeric($value)) { $value = (int)$value;