Permalink
Browse files

Separate execute processes

  • Loading branch information...
zeleznypa committed Jun 27, 2013
1 parent 7b1e42d commit 735b086a01ec1f87d5599a4d73123457a5fcea38
Showing with 36 additions and 3 deletions.
  1. +36 −3 Zeleznypa/Curl/SimpleCurl.php
@@ -39,9 +39,9 @@ public function __construct($url = NULL)
*/
public function execute()
{
curl_setopt_array($this->getHandler(), $this->getOptions());
$this->result = curl_exec($this->getHandler());
curl_close($this->getHandler());
$this->processOptions();
$this->processResponse();
$this->processClose();
return $this;
}
@@ -141,4 +141,37 @@ protected function getHandler()
return $this->handler;
}
/**
* Process cURL options
* @author Pavel Železný <info@pavelzelezny.cz>
* @return \Zeleznypa\Curl\SimpleCurl Provides fluent interface
*/
protected function processOptions()
{
curl_setopt_array($this->getHandler(), $this->getOptions());
return $this;
}
/**
* Process cURL response
* @author Pavel Železný <info@pavelzelezny.cz>
* @return \Zeleznypa\Curl\SimpleCurl Provides fluent interface
*/
protected function processResponse()
{
$this->result = curl_exec($this->getHandler());
return $this;
}
/**
* Process cURL close
* @author Pavel Železný <info@pavelzelezny.cz>
* @return \Zeleznypa\Curl\SimpleCurl Provides fluent interface
*/
protected function processClose()
{
curl_close($this->getHandler());
return $this;
}
}

0 comments on commit 735b086

Please sign in to comment.