public __get ( $key ) |
public function __get($key)
{
if (method_exists($this, 'get_' . $key)) {
return call_user_func(array($this, 'get_' . $key));
} else {
/* translators: %s: property key */
return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
}
}
public function test_magic_get_method() { $customer = new Give_Customer('*****@*****.**'); $this->assertEquals('*****@*****.**', $customer->email); $this->assertTrue(is_wp_error($customer->__get('asdf'))); }