我想从同一个类的其他方法内的闭包内调用一个类的私有静态方法,我找不到正确的方法要做到这一点... 甚至使用使用引用私有方法...我能够引用私有变量并传递它,但没有办法引用私有方法... $ refMethod = array('App ”, '_的onEvent');与使用call_user_func($ refMethod)将抛出的方法是私人的... 我试着用ReflectionClass与PHP 5.4版本也(WAMP 32位),但它说getClosure方法不存在的实例:(从闭包(类内)调用私有静态方法
class App(){
static public function start(){
new Form('myform', array('submit'=>function($form) use($someVar){
if($anyCondition){
// want to call private self::_onEvent here : any suggestion ?
}
}));
}
static private function _onEvent(){
// this is my very private part
}
}
嗯,我知道相当封闭没有范围,但这样...任何方式来传递专用上下文(因为闭包是类中),用于完成这样的感谢任何灯光
编辑?!我确实想要this answer但这只是抛出伟大的
无法访问自己::当无级范围活跃