1
0

AccountProperty.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. }