Skip to content

Apply fixes from StyleCI #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/Core/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,24 @@ public function post($url, $options = [])
return $this->request($url, 'POST', [$key => $options]);
}

/**
* JSON request.
*
* @param string $url
* @param string|array $options
* @param array $queries
* @param int $encodeOption
*
* @return ResponseInterface
*
* @throws HttpException
*/
public function json($url, $options = [], $encodeOption = JSON_UNESCAPED_UNICODE, $queries = [])
{
is_array($options) && $options = json_encode($options, $encodeOption);

return $this->request($url, 'POST', ['query' => $queries, 'body' => $options, 'headers' => ['content-type' => 'application/json']]);
}
/**
* JSON request.
*
* @param string $url
* @param string|array $options
* @param array $queries
* @param int $encodeOption
*
* @return ResponseInterface
*
* @throws HttpException
*/
public function json($url, $options = [], $encodeOption = JSON_UNESCAPED_UNICODE, $queries = [])
{
is_array($options) && $options = json_encode($options, $encodeOption);

return $this->request($url, 'POST', ['query' => $queries, 'body' => $options, 'headers' => ['content-type' => 'application/json']]);
}

/**
* Upload file.
Expand Down
1 change: 1 addition & 0 deletions src/Material/Material.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ public function getAPIByType($type)
switch ($type) {
case 'news_image':
$api = self::API_NEWS_IMAGE_UPLOAD;

break;
default:
$api = self::API_UPLOAD;
Expand Down
1 change: 1 addition & 0 deletions src/Payment/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function getNotify()
if (!empty($this->notify)) {
return $this->notify;
}

try {
$xml = XML::parse(strval($this->request->getContent()));
} catch (\Throwable $t) {
Expand Down
1 change: 1 addition & 0 deletions src/Server/Guard.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ protected function buildResponse($to, $from, $message)

if (!$this->isMessage($message)) {
$messageType = gettype($message);

throw new InvalidArgumentException("Invalid Message type .'{$messageType}'");
}

Expand Down
1 change: 1 addition & 0 deletions tests/Core/CoreHttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function testParseJSON()
{
$http = new Http();
$http->setClient($this->getGuzzleWithResponse('{"foo:"bar"}'));

try {
$http->parseJSON($http->request('http://overtrue.me', 'GET'));
$this->assertFail('Invalid json body check fail.');
Expand Down