Skip to content

Commit a88cb5c

Browse files
committed
Fix english in no response message
1 parent 4390b4e commit a88cb5c

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
git fetch origin $TRAVIS_BRANCH;
7878
fi
7979
- git merge-base origin/$TRAVIS_BRANCH $TRAVIS_PULL_REQUEST_SHA || git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge --unshallow
80-
- wget https://github.com/diff-sniffer/git/releases/download/0.1.0/git-phpcs.phar
80+
- wget https://github.com/diff-sniffer/git/releases/download/0.2.0/git-phpcs.phar
8181
- php git-phpcs.phar origin/$TRAVIS_BRANCH...$TRAVIS_PULL_REQUEST_SHA
8282

8383
# - stage: Code Quality

src/Exception/QueryException.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ public static function cannotInsertEmptyValues() : self
1212
{
1313
return new self('Inserting empty values array is not supported in ClickHouse');
1414
}
15+
16+
public static function noResponse() : self
17+
{
18+
return new self('No response returned');
19+
}
1520
}

src/Statement.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,10 @@ public function isError()
183183
return ($this->response()->http_code() !== 200 || $this->response()->error_no());
184184
}
185185

186-
/**
187-
* @return bool
188-
* @throws Exception\TransportException
189-
*/
190-
private function check()
186+
private function check() : bool
191187
{
192188
if (!$this->_request->isResponseExists()) {
193-
throw new QueryException('Not have response');
189+
throw QueryException::noResponse();
194190
}
195191

196192
if ($this->isError()) {

src/Transport/CurlerRequest.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace ClickHouseDB\Transport;
44

5+
use const CURLOPT_HTTPGET;
6+
use const CURLOPT_POST;
7+
58
class CurlerRequest
69
{
710
/**
@@ -44,14 +47,10 @@ class CurlerRequest
4447
*/
4548
private $handle;
4649

47-
/**
48-
* @var CurlerResponse
49-
*/
50-
private $resp = null;
50+
/** @var CurlerResponse */
51+
private $response;
5152

52-
/**
53-
* @var bool
54-
*/
53+
/** @var bool */
5554
private $_persistent = false;
5655

5756
/**
@@ -616,24 +615,21 @@ private function execute($method)
616615
*/
617616
public function response()
618617
{
619-
if (!$this->resp) {
618+
if (! $this->response) {
620619
throw new \ClickHouseDB\Exception\TransportException('Can`t fetch response - is empty');
621620
}
622621

623-
return $this->resp;
622+
return $this->response;
624623
}
625624

626-
/**
627-
* @return bool
628-
*/
629-
public function isResponseExists()
625+
public function isResponseExists() : bool
630626
{
631-
return ($this->resp ? true : false);
627+
return $this->response !== null;
632628
}
633629

634-
public function setResponse(CurlerResponse $response)
630+
public function setResponse(CurlerResponse $response) : void
635631
{
636-
$this->resp = $response;
632+
$this->response = $response;
637633
}
638634

639635
/**
@@ -678,12 +674,12 @@ private function prepareRequest()
678674

679675

680676
if (strtoupper($method) == 'GET') {
681-
$curl_opt[CURLOPT_HTTPGET] = TRUE;
677+
$curl_opt[CURLOPT_HTTPGET] = true;
682678
$curl_opt[CURLOPT_CUSTOMREQUEST] = strtoupper($method);
683679
$curl_opt[CURLOPT_POSTFIELDS] = false;
684680
} else {
685681
if (strtoupper($method) === 'POST') {
686-
$curl_opt[CURLOPT_POST] = TRUE;
682+
$curl_opt[CURLOPT_POST] = true;
687683
}
688684

689685
$curl_opt[CURLOPT_CUSTOMREQUEST] = strtoupper($method);

0 commit comments

Comments
 (0)