You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
2.8 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OC\Accounts;
  25. use OCP\Accounts\IAccountProperty;
  26. class AccountProperty implements IAccountProperty {
  27. /** @var string */
  28. private $name;
  29. /** @var string */
  30. private $value;
  31. /** @var string */
  32. private $scope;
  33. /** @var string */
  34. private $verified;
  35. public function __construct(string $name, string $value, string $scope, string $verified) {
  36. $this->name = $name;
  37. $this->value = $value;
  38. $this->scope = $scope;
  39. $this->verified = $verified;
  40. }
  41. public function jsonSerialize() {
  42. return [
  43. 'name' => $this->getName(),
  44. 'value' => $this->getValue(),
  45. 'scope' => $this->getScope(),
  46. 'verified' => $this->getVerified()
  47. ];
  48. }
  49. /**
  50. * Set the value of a property
  51. *
  52. * @since 15.0.0
  53. *
  54. * @param string $value
  55. * @return IAccountProperty
  56. */
  57. public function setValue(string $value): IAccountProperty {
  58. $this->value = $value;
  59. return $this;
  60. }
  61. /**
  62. * Set the scope of a property
  63. *
  64. * @since 15.0.0
  65. *
  66. * @param string $scope
  67. * @return IAccountProperty
  68. */
  69. public function setScope(string $scope): IAccountProperty {
  70. $this->scope = $scope;
  71. return $this;
  72. }
  73. /**
  74. * Set the verification status of a property
  75. *
  76. * @since 15.0.0
  77. *
  78. * @param string $verified
  79. * @return IAccountProperty
  80. */
  81. public function setVerified(string $verified): IAccountProperty {
  82. $this->verified = $verified;
  83. return $this;
  84. }
  85. /**
  86. * Get the name of a property
  87. *
  88. * @since 15.0.0
  89. *
  90. * @return string
  91. */
  92. public function getName(): string {
  93. return $this->name;
  94. }
  95. /**
  96. * Get the value of a property
  97. *
  98. * @since 15.0.0
  99. *
  100. * @return string
  101. */
  102. public function getValue(): string {
  103. return $this->value;
  104. }
  105. /**
  106. * Get the scope of a property
  107. *
  108. * @since 15.0.0
  109. *
  110. * @return string
  111. */
  112. public function getScope(): string {
  113. return $this->scope;
  114. }
  115. /**
  116. * Get the verification status of a property
  117. *
  118. * @since 15.0.0
  119. *
  120. * @return string
  121. */
  122. public function getVerified(): string {
  123. return $this->verified;
  124. }
  125. }