Skip to content

Commit 6af21eb

Browse files
committed
Add styleci
1 parent 7dd08ba commit 6af21eb

File tree

8 files changed

+28
-15
lines changed

8 files changed

+28
-15
lines changed

.styleci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
preset: psr2
2+
3+
enabled:
4+
- duplicate_semicolon
5+
- empty_return
6+
- extra_empty_lines
7+
- operators_spaces
8+
- phpdoc_indent
9+
- remove_leading_slash_use
10+
- spaces_cast
11+
- ternary_spaces
12+
- unused_use
13+
14+
disabled:
15+
- braces
16+
- parenthesis

src/Adapter/Guzzle/GuzzleAdapter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class GuzzleAdapter implements AdapterInterface {
3333
*/
3434
public function __construct(Client $client = null, MessageFactoryInterface $messageFactory = null)
3535
{
36-
$this->client = $client ? : new Client;
36+
$this->client = $client ?: new Client;
3737

38-
$this->messageFactory = $messageFactory ? : new MessageFactory;
38+
$this->messageFactory = $messageFactory ?: new MessageFactory;
3939
}
4040

4141
/**

src/Proxy.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function applyRequestFilter(Request $request)
148148
{
149149
$request = $filter->filter($request) ?: $request;
150150
}
151-
else if ($filter instanceof Closure)
151+
elseif ($filter instanceof Closure)
152152
{
153153
$request = $filter($request) ?: $request;
154154
}
@@ -171,7 +171,7 @@ protected function applyResponseFilter(Response $response)
171171
{
172172
$response = $filter->filter($response) ?: $response;
173173
}
174-
else if ($filter instanceof Closure)
174+
elseif ($filter instanceof Closure)
175175
{
176176
$response = $filter($response) ?: $response;
177177
}

tests/Proxy/Adapter/Dummy/DummyAdapterTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace Proxy\Adapter\Dummy;
33

4-
54
use Symfony\Component\HttpFoundation\Request;
65

76
class DummyAdapterTest extends \PHPUnit_Framework_TestCase

tests/Proxy/Adapter/Guzzle/GuzzleAdapterTest.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function setUp()
3535
$response = $this->createResponse();
3636

3737
$mock = new MockHandler([
38-
'status' => $response->getStatusCode(),
38+
'status' => $response->getStatusCode(),
3939
'headers' => $response->getHeaders(),
40-
'body' => $response->getBody(),
40+
'body' => $response->getBody(),
4141
]);
4242

4343
$client = new Client(['handler' => $mock]);
@@ -94,7 +94,7 @@ public function adapter_sends_request()
9494
->disableOriginalConstructor()
9595
->getMock();
9696

97-
$verifyParam = $this->callback(function(\GuzzleHttp\Message\Request $request) {
97+
$verifyParam = $this->callback(function (\GuzzleHttp\Message\Request $request) {
9898
return $request->getUrl() == 'http://www.example.com';
9999
});
100100

@@ -114,6 +114,7 @@ public function adapter_sends_request()
114114
private function sendRequest()
115115
{
116116
$request = Request::createFromGlobals();
117+
117118
return $this->adapter->send($request, 'http://www.example.com');
118119
}
119120

@@ -123,6 +124,7 @@ private function sendRequest()
123124
private function createResponse()
124125
{
125126
$body = Stream::factory($this->body);
127+
126128
return new Response($this->status, $this->headers, $body);
127129
}
128130

tests/Proxy/ProxyTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function to_throws_exception_if_no_request_is_given()
2828
$this->proxy->to('/');
2929
}
3030

31-
3231
/**
3332
* @test
3433
*/
@@ -130,7 +129,7 @@ public function to_applies_request_filter_closure()
130129
{
131130
$executed = false;
132131

133-
$this->proxy->addRequestFilter(function(Request $request) use (&$executed)
132+
$this->proxy->addRequestFilter(function (Request $request) use (&$executed)
134133
{
135134
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Request', $request);
136135
$executed = true;
@@ -148,7 +147,7 @@ public function to_applies_response_filter_closure()
148147
{
149148
$executed = false;
150149

151-
$this->proxy->addResponseFilter(function(Response $response) use (&$executed)
150+
$this->proxy->addResponseFilter(function (Response $response) use (&$executed)
152151
{
153152
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
154153
$executed = true;
@@ -166,7 +165,7 @@ public function to_request_filter_returns_new_request()
166165
{
167166
$replace = new Request;
168167

169-
$this->proxy->addRequestFilter(function(Request $request) use ($replace)
168+
$this->proxy->addRequestFilter(function (Request $request) use ($replace)
170169
{
171170
return $replace;
172171
});

tests/Proxy/Response/Filter/RemoveEncodingFilterTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace Proxy\Response\Filter;
33

4-
54
use Symfony\Component\HttpFoundation\Response;
65

76
class RemoveEncodingFilterTest extends \PHPUnit_Framework_TestCase

tests/Proxy/Response/Filter/RemoveLocationFilterTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
namespace Proxy\Response\Filter;
33

4-
5-
use Proxy\Response\Filter\RemoveLocationFilter;
64
use Symfony\Component\HttpFoundation\Response;
75

86
class RemoveLocationFilterTest extends \PHPUnit_Framework_TestCase

0 commit comments

Comments
 (0)