Ik had een beetje genoeg van steeds
curl_setopt($ch,CURLOPT_xxx,$value)
typen ...
$curl->xxx = $value
.
public function __set($key,$value){
if(!array_key_exists($key,$this->getOptions())) throw new \Exception("Unknown option '$key'");
$this->setopt($this->_options[$key],$value);
}
public function __get($key){
if(!array_key_exists($key,$this->getInfos())) throw new \Exception("Unknown info '$key'");
return $this->getinfo($this->_infos[$key]);
}
public function __call($func_name,$params){
return call_user_func_array('curl_' . Str::snake($func_name),array_merge([$this->_handle],$params));
}
Rob, zaterdag 21 januari 2017, 12:20