Skip to content

Commit

Permalink
syntax cleanup on aisle 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan committed May 21, 2014
1 parent 53ed383 commit 21bdacf
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Httpful/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ public function authenticateWithDigest($username, $password)
/**
* @return is this request setup for client side cert?
*/
public function hasClientSideCert() {
public function hasClientSideCert()
{
return isset($this->client_cert) && isset($this->client_key);
}

Expand Down Expand Up @@ -343,7 +344,7 @@ public function mime($mime)
{
if (empty($mime)) return $this;
$this->content_type = $this->expected_type = Mime::getFullMime($mime);
if($this->isUpload()) {
if ($this->isUpload()) {
$this->neverSerializePayload();
}
return $this;
Expand Down Expand Up @@ -388,7 +389,8 @@ public function expectsType($mime)
return $this->expects($mime);
}

public function attach($files) {
public function attach($files)
{
foreach ($files as $key => $file) {
if (function_exists('curl_file_create')) {
$this->payload[$key] = curl_file_create($file);
Expand All @@ -408,7 +410,7 @@ public function contentType($mime)
{
if (empty($mime)) return $this;
$this->content_type = Mime::getFullMime($mime);
if($this->isUpload()) {
if ($this->isUpload()) {
$this->neverSerializePayload();
}
return $this;
Expand Down Expand Up @@ -452,9 +454,10 @@ public function withStrictSSL()
* @param string $auth_username Authentication username. Default null
* @param string $auth_password Authentication password. Default null
*/
public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null){
public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
{
$this->addOnCurlOption(CURLOPT_PROXY, "{$proxy_host}:{$proxy_port}");
if(in_array($auth_type, array(CURLAUTH_BASIC,CURLAUTH_NTLM)) ){
if (in_array($auth_type, array(CURLAUTH_BASIC,CURLAUTH_NTLM))) {
$this->addOnCurlOption(CURLOPT_PROXYAUTH, $auth_type)
->addOnCurlOption(CURLOPT_PROXYUSERPWD, "{$auth_username}:{$auth_password}");
}
Expand All @@ -464,7 +467,8 @@ public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth
/**
* @return is this request setup for using proxy?
*/
public function hasProxy(){
public function hasProxy()
{
return isset($this->additional_curl_opts[CURLOPT_PROXY]) && is_string($this->additional_curl_opts[CURLOPT_PROXY]);
}

Expand Down Expand Up @@ -830,7 +834,7 @@ public function _curlPrep()
if (isset($this->payload)) {
$this->serialized_payload = $this->_serializePayload($this->payload);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->serialized_payload);
if(!$this->isUpload()) {
if (!$this->isUpload()) {
$this->headers['Content-Length'] =
$this->_determineLength($this->serialized_payload);
}
Expand Down

0 comments on commit 21bdacf

Please sign in to comment.