Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 0fa30d6

Browse files
committed
Minor CS issues
- Updated docblocks on changed files - Reworded test method - Space after `!` operators - Wrapped long lines
1 parent 91a585e commit 0fa30d6

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* @link http://github.com/zendframework/zend-json-server for the canonical source repository
4-
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5-
* @license http://framework.zend.com/license/new-bsd New BSD License
3+
* @see https://github.com/zendframework/zend-json-server for the canonical source repository
4+
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-json-server/blob/master/LICENSE.md New BSD License
66
*/
77

88
namespace Zend\Json\Server;
@@ -117,13 +117,13 @@ public function doRequest($request)
117117
$this->httpClient->setUri($this->serverAddress);
118118
}
119119

120-
// set default Accept and Content-Type headers unless already set
120+
// Set default Accept and Content-Type headers unless already set.
121121
$headers = $httpRequest->getHeaders();
122122
$headersToAdd = [];
123-
if (!$headers->has('Content-Type')) {
123+
if (! $headers->has('Content-Type')) {
124124
$headersToAdd['Content-Type'] = 'application/json-rpc';
125125
}
126-
if (!$headers->has('Accept')) {
126+
if (! $headers->has('Accept')) {
127127
$headersToAdd['Accept'] = 'application/json-rpc';
128128
}
129129
$headers->addHeaders($headersToAdd);

src/Server.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,11 @@ protected function handleRequest()
601601
* method on success, Error if there is a mismatch between request
602602
* parameters and the method signature.
603603
*/
604-
private function validateAndPrepareParams(array $requestedParams, array $serviceParams, Method\Definition $invokable)
605-
{
604+
private function validateAndPrepareParams(
605+
array $requestedParams,
606+
array $serviceParams,
607+
Method\Definition $invokable
608+
) {
606609
return is_string(key($requestedParams))
607610
? $this->validateAndPrepareNamedParams($requestedParams, $serviceParams, $invokable)
608611
: $this->validateAndPrepareOrderedParams($requestedParams, $serviceParams);
@@ -618,8 +621,11 @@ private function validateAndPrepareParams(array $requestedParams, array $service
618621
* method on success, Error if any named request parameters do not match
619622
* those of the method requested.
620623
*/
621-
private function validateAndPrepareNamedParams(array $requestedParams, array $serviceParams, Method\Definition $invokable)
622-
{
624+
private function validateAndPrepareNamedParams(
625+
array $requestedParams,
626+
array $serviceParams,
627+
Method\Definition $invokable
628+
) {
623629
if (count($requestedParams) < count($serviceParams)) {
624630
$requestedParams = $this->getDefaultParams($requestedParams, $serviceParams);
625631
}

test/ClientTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<?php
22
/**
3-
* @link http://github.com/zendframework/zend-json-server for the canonical source repository
4-
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5-
* @license http://framework.zend.com/license/new-bsd New BSD License
3+
* @see https://github.com/zendframework/zend-json-server for the canonical source repository
4+
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-json-server/blob/master/LICENSE.md New BSD License
66
*/
77

88
namespace ZendTest\Json\Server;
99

1010
use PHPUnit_Framework_TestCase as TestCase;
1111
use Zend\Http\Client as HttpClient;
1212
use Zend\Http\Client\Adapter\Test as TestAdapter;
13+
use Zend\Http\Response as HttpResponse;
1314
use Zend\Json\Server\Client;
1415
use Zend\Json\Server\Error;
1516
use Zend\Json\Server\Request;
1617
use Zend\Json\Server\Response;
17-
use Zend\Http\Response as HttpResponse;
1818

1919
class ClientTest extends TestCase
2020
{
@@ -248,7 +248,7 @@ public function testClientShouldSetDefaultAcceptAndContentTypeHeadersOnRequest()
248248
$this->assertSame('application/json-rpc', $jsonClient->getHttpClient()->getHeader('Accept'));
249249
}
250250

251-
public function testClientShouldNotSetDefaultAcceptAndContentTypeHeadersOnRequestIfTheyAlreadyExist()
251+
public function testClientShouldNotOverwriteAcceptAndContentTypeHeadersIfAlreadyPresentInRequest()
252252
{
253253
$request = new Request();
254254
$response = new HttpResponse();

0 commit comments

Comments
 (0)