Skip to content

Commit f9a9058

Browse files
committed
Update ez_sql_core.php
in reference to #150
1 parent 4e38ef9 commit f9a9058

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

shared/ez_sql_core.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ public function __construct()
9393
parent::__construct();
9494
}
9595

96+
/**
97+
* Use for Calling Non-Existent Functions, handling Getters and Setters
98+
* @param function set/get{name} = private/protected property that needs to be accessed
99+
*/
100+
public function __call($function, $args)
101+
{
102+
$prefix = substr($function, 0, 3);
103+
$property = strtolower(substr($function, 3, strlen($function)));
104+
if ($prefix == 'set') {
105+
$this->$property = $args[0];
106+
} elseif ($prefix == 'get') {
107+
return $this->$property;
108+
} else {
109+
throw new Exception("$function does not exist");
110+
}
111+
}
112+
96113
/**
97114
* Get host and port from an "host:port" notation.
98115
* Returns array of host and port. If port is omitted, returns $default

0 commit comments

Comments
 (0)