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...
15
{
16
30
if($data !== NULL)
17
30
{
18
30
foreach($data AS $key=>$value)
19
{
20
30
$this->__set($key,$value);
21
30
}
22
30
}
23
30
}
24
25
30
public function __set($key, $value)
26
{
27
30
if(array_key_exists($key, $this->fields))
28
30
{
29
30
$this->fields[$key] = $value;
30
30
}
31
30
}
32
33
13
public function __get($key)
34
{
35
13
if(array_key_exists($key, $this->fields))
36
13
{
37
13
return $this->fields[$key];
38
}
39
else
40
{
41
throw new \Exception("$key is not a valid property of class ".__CLASS__);
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.