It is generally recommended to explicitly declare the visibility for methods.
Adding explicit visibility (private, protected, or public) is generally
recommend to communicate to other developers how, and from where this method
is intended to be used.
Loading history...
25
return new static($client, ...$params);
26
}
27
28
/**
29
* Load data onto this object. Chainable method.
30
*
31
* @param \stdClass $data
32
*
33
* @return self
34
*/
35
public function init($data = null)
36
{
37
$this->data = $data;
38
39
return $this;
40
}
41
42
/**
43
* Get the raw data object.
44
*/
45
public function getData()
46
{
47
return $this->data;
48
}
49
50
/**
51
* Magic!
52
* @param string $key
53
* @return mixed
54
*/
55
public function __get($key)
56
{
57
// If there's a getter method, call it.
58
$method = 'get' . ucfirst($key);
59
if (method_exists($this, $method)) {
60
return $this->$method();
61
}
62
63
$this->init();
64
65
// If the property is defined in our data object, return it.
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.