Give_Customer::__get PHP Method

__get() public method

Magic __get function to dispatch a call to retrieve a private property.
Since: 1.0
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));
        }
    }

Usage Example

Ejemplo n.º 1
0
 public function test_magic_get_method()
 {
     $customer = new Give_Customer('*****@*****.**');
     $this->assertEquals('*****@*****.**', $customer->email);
     $this->assertTrue(is_wp_error($customer->__get('asdf')));
 }