Skip to content

Commit

Permalink
Comments + refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
iGusev committed Aug 17, 2015
1 parent 1203e66 commit a0bd3be
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/BotApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

class BotApi
{
/**
* HTTP codes
*
* @var array
*/
public static $codes = array(
// Informational 1xx
100 => 'Continue',
Expand Down Expand Up @@ -58,6 +63,12 @@ class BotApi
509 => 'Bandwidth Limit Exceeded'
);


/**
* Default http status code
*/
const DEFAULT_STATUS_CODE = 200;

/**
* Url prefix
*/
Expand Down Expand Up @@ -135,7 +146,7 @@ public function call($method, array $data = null)

$result = curl_exec($this->curl);

if(($httpCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE)) && $httpCode !== 200) {
if(($httpCode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE)) && $httpCode !== self::DEFAULT_STATUS_CODE) {
throw new HttpException(self::$codes[$httpCode], $httpCode);
}

Expand Down

0 comments on commit a0bd3be

Please sign in to comment.