class-basic-object.php 771 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Unit Tests: Basic_Object cloass
  4. *
  5. * @package WordPress
  6. * @subpackage UnitTests
  7. * @since 4.7.0
  8. */
  9. /**
  10. * Class used to test accessing methods and properties
  11. *
  12. * @since 4.0.0
  13. */
  14. class Basic_Object {
  15. private $foo = 'bar';
  16. public function __get( $name ) {
  17. return $this->$name;
  18. }
  19. public function __set( $name, $value ) {
  20. return $this->$name = $value;
  21. }
  22. public function __isset( $name ) {
  23. return isset( $this->$name );
  24. }
  25. public function __unset( $name ) {
  26. unset( $this->$name );
  27. }
  28. public function __call( $name, $arguments ) {
  29. return call_user_func_array( array( $this, $name ), $arguments );
  30. }
  31. // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
  32. private function callMe() {
  33. return 'maybe';
  34. }
  35. }