我正在尝试理解这段代码,但当我到达最后一行时,我没明白。 :(
你能帮我找出 return $this
是什么意思吗?
public function setOptions(array $options) {
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
//???? - return what ?
return $this;
}
更新:
我已经删除了我的评论以便更好地阐明。