我不知道为什么这会引发错误 - 希望有人能看到这个问题?
$client->set('place', 'home');
$client->placeInfo();
$client->screen($client->response());
$client->unset('place');
致命错误:调用未定义的方法 Client::unset()...
客户类
// stores the client data
private $data = array();
// stores the result of the last method
private $response = NULL;
/**
* Sets data into the client data array. This will be later referenced by
* other methods in this object to extract data required.
*
* @param str $key - The data parameter
* @param str $value - The data value
* @return $this - The current (self) object
*/
public function set($key, $value) {
$this->data[$key] = $value;
return $this;
}
/**
* dels data in the client data array.
*
* @param str $key - The data parameter
* @return $this - The current (self) object
*/
public function del($key) {
unset($this->data[$key]);
return $this;
}
/**
* Gets data from the client data array.
*
* @param str $key - The data parameter
* @return str $value - The data value
*/
private function get($key) {
return $this->data[$key];
}
/**
* Returns the result / server response from the last method
*
* @return $this->response
*/
public function response() {
return $this->response;
}
public function placeInfo() {
$this->response = $this->srv()->placeInfo(array('place' => $this->get('place')));
return $this;
}