Permalink
Browse files

Default options

  • Loading branch information...
zeleznypa committed Jul 8, 2013
1 parent 735b086 commit 68bfb610fcb35f0811b182c467ba382a1a26338f
Showing with 46 additions and 0 deletions.
  1. +46 −0 Zeleznypa/Curl/Curl.php
@@ -0,0 +1,46 @@
<?php
namespace Zeleznypa\Curl;
/**
* cURL wrapper
* @author Pavel Železný <info@pavelzelezny.cz>
*/
class Curl extends \Zeleznypa\Curl\SimpleCurl
{
/**
* Real request cURL options getter
* @author Pavel Železný <info@pavelzelezny.cz>
* @return array
*/
public function getRequestOptions()
{
return $this->getDefaultOptions() + $this->getOptions();
}
/**
* Get default cURL options
* @author Pavel Železný <info@pavelzelezny.cz>
* @return array
*/
protected function getDefaultOptions()
{
$options[CURLOPT_CONNECTTIMEOUT] = 30;
$options[CURLOPT_RETURNTRANSFER] = TRUE;
$options[CURLOPT_TIMEOUT] = 30;
return $options;
}
/**
* Process cURL options
* @author Pavel Železný <info@pavelzelezny.cz>
* @return \Zeleznypa\Curl\Curl Provides fluent interface
*/
protected function processOptions()
{
curl_setopt_array($this->getHandler(), $this->getRequestOptions());
return $this;
}
}

0 comments on commit 68bfb61

Please sign in to comment.