Skip to content

Commit

Permalink
Update kladr.php
Browse files Browse the repository at this point in the history
Iliya Garakh committed Jul 3, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2712793 commit de29a56
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kladr.php
Original file line number Diff line number Diff line change
@@ -9,18 +9,22 @@ class Api
{
private $token;
private $key;
private $domain;

private $error;

/**
* @param string $token
* @param string $key
*/
public function __construct($token, $key)
public function __construct($token, $key, $domain = false)
{
$this->token = $token;
$this->key = $key;
$this->error = NULL;
$this->domain = 'http://kladr-api.ru/';
if($domain)
$this->domain = domain;
}

private function GetURL(Query $query)
@@ -30,17 +34,12 @@ private function GetURL(Query $query)
return FALSE;
}

if (empty($this->key)) {
$this->error = 'Ключ не может быть пустым';
return FALSE;
}

if (empty($query)) {
$this->error = 'Объект запроса не может быть пустым';
return FALSE;
}

return 'http://kladr-api.ru/api.php?' . $query . '&token=' . $this->token . '&key=' . $this->key;
return $this->domain . 'api.php?' . $query . '&token=' . $this->token;
}

/**

0 comments on commit de29a56

Please sign in to comment.