Skip to content

Commit 3b188cb

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

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-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: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,10 @@ class CurlerRequest
4444
*/
4545
private $handle;
4646

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

52-
/**
53-
* @var bool
54-
*/
50+
/** @var bool */
5551
private $_persistent = false;
5652

5753
/**
@@ -616,24 +612,21 @@ private function execute($method)
616612
*/
617613
public function response()
618614
{
619-
if (!$this->resp) {
615+
if (! $this->response) {
620616
throw new \ClickHouseDB\Exception\TransportException('Can`t fetch response - is empty');
621617
}
622618

623-
return $this->resp;
619+
return $this->response;
624620
}
625621

626-
/**
627-
* @return bool
628-
*/
629-
public function isResponseExists()
622+
public function isResponseExists() : bool
630623
{
631-
return ($this->resp ? true : false);
624+
return $this->response !== null;
632625
}
633626

634-
public function setResponse(CurlerResponse $response)
627+
public function setResponse(CurlerResponse $response) : void
635628
{
636-
$this->resp = $response;
629+
$this->response = $response;
637630
}
638631

639632
/**
@@ -678,12 +671,12 @@ private function prepareRequest()
678671

679672

680673
if (strtoupper($method) == 'GET') {
681-
$curl_opt[CURLOPT_HTTPGET] = TRUE;
674+
$curl_opt[CURLOPT_HTTPGET] = true;
682675
$curl_opt[CURLOPT_CUSTOMREQUEST] = strtoupper($method);
683676
$curl_opt[CURLOPT_POSTFIELDS] = false;
684677
} else {
685678
if (strtoupper($method) === 'POST') {
686-
$curl_opt[CURLOPT_POST] = TRUE;
679+
$curl_opt[CURLOPT_POST] = true;
687680
}
688681

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

0 commit comments

Comments
 (0)