私のオーバーロードされたすべての__get関数は、この例のようにhttp://us3.php.net/manual/en/language.oop5.overloading.php#object.issetになり、デバッグコードが含まれていますか?PHP __get overload code良い練習
public function __get($name)
{
echo "Getting '$name'\n";
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
}
/*question specific code from here on*/
$trace = debug_backtrace();
trigger_error(
'Undefined property via __get(): ' . $name .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return null;
}
すべてのクラスにオーバーロードが含まれていると、重複したコードが多くなる可能性があります。
継承または静的ヘルパークラスについて考えましたか? – rcdmk