TestClass.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
  11. class TestClass
  12. {
  13. public $publicProperty;
  14. protected $protectedProperty;
  15. private $privateProperty;
  16. private $publicAccessor;
  17. private $publicMethodAccessor;
  18. private $publicGetSetter;
  19. private $publicAccessorWithDefaultValue;
  20. private $publicAccessorWithRequiredAndDefaultValue;
  21. private $publicAccessorWithMoreRequiredParameters;
  22. private $publicIsAccessor;
  23. private $publicHasAccessor;
  24. private $publicGetter;
  25. public function __construct($value)
  26. {
  27. $this->publicProperty = $value;
  28. $this->publicAccessor = $value;
  29. $this->publicMethodAccessor = $value;
  30. $this->publicGetSetter = $value;
  31. $this->publicAccessorWithDefaultValue = $value;
  32. $this->publicAccessorWithRequiredAndDefaultValue = $value;
  33. $this->publicAccessorWithMoreRequiredParameters = $value;
  34. $this->publicIsAccessor = $value;
  35. $this->publicHasAccessor = $value;
  36. $this->publicGetter = $value;
  37. }
  38. public function setPublicAccessor($value)
  39. {
  40. $this->publicAccessor = $value;
  41. }
  42. public function setPublicAccessorWithDefaultValue($value = null)
  43. {
  44. $this->publicAccessorWithDefaultValue = $value;
  45. }
  46. public function setPublicAccessorWithRequiredAndDefaultValue($value, $optional = null)
  47. {
  48. $this->publicAccessorWithRequiredAndDefaultValue = $value;
  49. }
  50. public function setPublicAccessorWithMoreRequiredParameters($value, $needed)
  51. {
  52. $this->publicAccessorWithMoreRequiredParameters = $value;
  53. }
  54. public function getPublicAccessor()
  55. {
  56. return $this->publicAccessor;
  57. }
  58. public function getPublicAccessorWithDefaultValue()
  59. {
  60. return $this->publicAccessorWithDefaultValue;
  61. }
  62. public function getPublicAccessorWithRequiredAndDefaultValue()
  63. {
  64. return $this->publicAccessorWithRequiredAndDefaultValue;
  65. }
  66. public function getPublicAccessorWithMoreRequiredParameters()
  67. {
  68. return $this->publicAccessorWithMoreRequiredParameters;
  69. }
  70. public function setPublicIsAccessor($value)
  71. {
  72. $this->publicIsAccessor = $value;
  73. }
  74. public function isPublicIsAccessor()
  75. {
  76. return $this->publicIsAccessor;
  77. }
  78. public function setPublicHasAccessor($value)
  79. {
  80. $this->publicHasAccessor = $value;
  81. }
  82. public function hasPublicHasAccessor()
  83. {
  84. return $this->publicHasAccessor;
  85. }
  86. public function publicGetSetter($value = null)
  87. {
  88. if (null !== $value) {
  89. $this->publicGetSetter = $value;
  90. }
  91. return $this->publicGetSetter;
  92. }
  93. public function getPublicMethodMutator()
  94. {
  95. return $this->publicGetSetter;
  96. }
  97. protected function setProtectedAccessor($value)
  98. {
  99. }
  100. protected function getProtectedAccessor()
  101. {
  102. return 'foobar';
  103. }
  104. protected function setProtectedIsAccessor($value)
  105. {
  106. }
  107. protected function isProtectedIsAccessor()
  108. {
  109. return 'foobar';
  110. }
  111. protected function setProtectedHasAccessor($value)
  112. {
  113. }
  114. protected function hasProtectedHasAccessor()
  115. {
  116. return 'foobar';
  117. }
  118. private function setPrivateAccessor($value)
  119. {
  120. }
  121. private function getPrivateAccessor()
  122. {
  123. return 'foobar';
  124. }
  125. private function setPrivateIsAccessor($value)
  126. {
  127. }
  128. private function isPrivateIsAccessor()
  129. {
  130. return 'foobar';
  131. }
  132. private function setPrivateHasAccessor($value)
  133. {
  134. }
  135. private function hasPrivateHasAccessor()
  136. {
  137. return 'foobar';
  138. }
  139. public function getPublicGetter()
  140. {
  141. return $this->publicGetter;
  142. }
  143. }