summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes/class-basic-object.php
blob: 30542257130dc4e4eeb29c297c89f67cf5a82f88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * Unit Tests: Basic_Object cloass
 *
 * @package WordPress
 * @subpackage UnitTests
 * @since 4.7.0
 */

/**
 * Class used to test accessing methods and properties
 *
 * @since 4.0.0
 */
class Basic_Object {

	private $arbitrary_props = array(
		'foo' => 'bar',
	);

	public function __get( $name ) {
		if ( array_key_exists( $name, $this->arbitrary_props ) ) {
			return $this->arbitrary_props[ $name ];
		}

		return null;
	}

	public function __set( $name, $value ) {
		$this->arbitrary_props[ $name ] = $value;
	}

	public function __isset( $name ) {
		return isset( $this->arbitrary_props[ $name ] );
	}

	public function __unset( $name ) {
		unset( $this->arbitrary_props[ $name ] );
	}

	public function __call( $name, $arguments ) {
		return call_user_func_array( array( $this, $name ), $arguments );
	}

	// phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
	private function callMe() {
		return 'maybe';
	}
}