Skip to content

Commit ec901c5

Browse files
committed
Merge pull request googleapis#87 from silvolu/master
Style fixes
2 parents 1cd92cc + b2a7d81 commit ec901c5

File tree

8 files changed

+84
-60
lines changed

8 files changed

+84
-60
lines changed

src/Google/Auth/OAuth2.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function refreshTokenWithAssertion($assertionCredentials = null)
264264
if (!$assertionCredentials) {
265265
$assertionCredentials = $this->assertionCredentials;
266266
}
267-
267+
268268
$cacheKey = $assertionCredentials->getCacheKey();
269269

270270
if ($cacheKey) {
@@ -279,15 +279,15 @@ public function refreshTokenWithAssertion($assertionCredentials = null)
279279
return;
280280
}
281281
}
282-
282+
283283
$this->refreshTokenRequest(
284284
array(
285285
'grant_type' => 'assertion',
286286
'assertion_type' => $assertionCredentials->assertionType,
287287
'assertion' => $assertionCredentials->generateAssertion(),
288288
)
289289
);
290-
290+
291291
if ($cacheKey) {
292292
// Attempt to cache the token.
293293
$this->client->getCache()->set(

src/Google/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ public function setScopes($scopes)
417417
$this->requestedScopes = array();
418418
$this->addScope($scopes);
419419
}
420-
420+
421421
/**
422-
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
422+
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
423423
* Will append any scopes not previously requested to the scope parameter.
424424
* A single string will be treated as a scope to request. An array of strings
425425
* will each be appended.
@@ -469,7 +469,7 @@ public function setDefer($defer)
469469
{
470470
$this->deferExecution = $defer;
471471
}
472-
472+
473473
/**
474474
* Helper method to execute deferred HTTP requests.
475475
*

src/Google/IO/Stream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ public function makeRequest(Google_Http_Request $request)
102102
);
103103

104104
$context = stream_context_create($options);
105-
105+
106106
$url = $request->getUrl();
107-
107+
108108
if ($request->canGzip()) {
109109
$url = self::ZLIB . $url;
110110
}
@@ -133,7 +133,7 @@ public function makeRequest(Google_Http_Request $request)
133133
$respHttpCode
134134
);
135135
}
136-
136+
137137
$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
138138

139139
if ($respHttpCode == 304 && $cached) {

src/Google/Model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __get($key)
5151
} else {
5252
$val = null;
5353
}
54-
54+
5555
if ($this->isAssociativeArray($val)) {
5656
if (isset($this->$keyDataType) && 'map' == $this->$keyDataType) {
5757
foreach ($val as $arrayKey => $arrayItem) {
@@ -97,7 +97,7 @@ protected function mapTypes($array)
9797
}
9898
$this->data = $array;
9999
}
100-
100+
101101
/**
102102
* Create a simplified object suitable for straightforward
103103
* conversion to JSON. This is relatively expensive
@@ -128,7 +128,7 @@ public function toSimpleObject()
128128
}
129129
return $object;
130130
}
131-
131+
132132
/**
133133
* Handle different types of values, primarily
134134
* other objects and map and array data types.

src/Google/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function urlSafeB64Decode($b64)
4646

4747
/**
4848
* Misc function used to count the number of bytes in a post body, in the
49-
* world of multi-byte chars and the unpredictability of
49+
* world of multi-byte chars and the unpredictability of
5050
* strlen/mb_strlen/sizeof, this is the only way to do that in a sane
5151
* manner at the moment.
5252
*

tests/general/ApiModelTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
require_once 'BaseTest.php';
2222

23-
class ApiModelTest extends BaseTest {
24-
public function testJsonStructure() {
23+
class ApiModelTest extends BaseTest
24+
{
25+
public function testJsonStructure()
26+
{
2527
$model = new Google_Model();
2628
$model->publicA = "This is a string";
2729
$model2 = new Google_Model();
@@ -43,13 +45,15 @@ public function testJsonStructure() {
4345
$this->assertArrayNotHasKey("data", $data);
4446
}
4547

46-
public function testIssetPropertyOnModel() {
48+
public function testIssetPropertyOnModel()
49+
{
4750
$model = new Google_Model();
4851
$model['foo'] = 'bar';
4952
$this->assertTrue(isset($model->foo));
5053
}
5154

52-
public function testUnsetPropertyOnModel() {
55+
public function testUnsetPropertyOnModel()
56+
{
5357
$model = new Google_Model();
5458
$model['foo'] = 'bar';
5559
unset($model->foo);

tests/general/IoTest.php

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,60 +22,69 @@
2222
require_once 'Google/Http/Request.php';
2323
require_once 'Google/IO/Stream.php';
2424

25-
class IoTest extends BaseTest {
26-
27-
public function testStreamParseHttpResponseBody() {
25+
class IoTest extends BaseTest
26+
{
27+
28+
public function testStreamParseHttpResponseBody()
29+
{
2830
$io = new Google_IO_Stream($this->getClient());
2931
$this->responseChecker($io);
3032
}
3133

32-
public function testStreamProcessEntityRequest() {
34+
public function testStreamProcessEntityRequest()
35+
{
3336
$client = $this->getClient();
3437
$io = new Google_IO_Stream($client);
3538
$this->processEntityRequest($io, $client);
3639
}
37-
38-
public function testStreamCacheHit() {
40+
41+
public function testStreamCacheHit()
42+
{
3943
$client = $this->getClient();
4044
$io = new Google_IO_Stream($client);
4145
$this->cacheHit($io, $client);
4246
}
43-
44-
public function testStreamAuthCache() {
47+
48+
public function testStreamAuthCache()
49+
{
4550
$client = $this->getClient();
4651
$io = new Google_IO_Stream($client);
4752
$this->authCache($io, $client);
4853
}
49-
54+
5055
/**
5156
* @expectedException Google_IO_Exception
5257
*/
53-
public function testInvalidRequest() {
58+
public function testInvalidRequest()
59+
{
5460
$io = new Google_IO_Stream($this->getClient());
5561
$url = "http://localhost:1";
5662
$req = new Google_Http_Request($url, "GET");
5763
$io->makeRequest($req);
5864
}
5965

6066
// Asserting Functions
61-
62-
public function cacheHit($io, $client) {
67+
68+
public function cacheHit($io, $client)
69+
{
6370
$url = "http://www.googleapis.com";
6471
// Create a cacheable request/response.
6572
// Should not be revalidated.
6673
$cacheReq = new Google_Http_Request($url, "GET");
67-
$cacheReq->setRequestHeaders(array(
68-
"Accept" => "*/*",
69-
));
74+
$cacheReq->setRequestHeaders(
75+
array("Accept" => "*/*",)
76+
);
7077
$cacheReq->setResponseBody("{\"a\": \"foo\"}");
7178
$cacheReq->setResponseHttpCode(200);
72-
$cacheReq->setResponseHeaders(array(
73-
"Cache-Control" => "private",
74-
"ETag" => "\"this-is-an-etag\"",
75-
"Expires" => "Sun, 22 Jan 2022 09:00:56 GMT",
76-
"Date" => "Sun, 1 Jan 2012 09:00:56 GMT",
77-
"Content-Type" => "application/json; charset=UTF-8",
78-
));
79+
$cacheReq->setResponseHeaders(
80+
array(
81+
"Cache-Control" => "private",
82+
"ETag" => "\"this-is-an-etag\"",
83+
"Expires" => "Sun, 22 Jan 2022 09:00:56 GMT",
84+
"Date" => "Sun, 1 Jan 2012 09:00:56 GMT",
85+
"Content-Type" => "application/json; charset=UTF-8",
86+
)
87+
);
7988

8089
// Populate the cache.
8190
$io->setCachedRequest($cacheReq);
@@ -86,30 +95,36 @@ public function cacheHit($io, $client) {
8695
$this->assertEquals(200, $res->getResponseHttpCode());
8796
}
8897

89-
public function authCache($io, $client) {
98+
public function authCache($io, $client)
99+
{
90100
$url = "http://www.googleapis.com/protected/resource";
91101

92102
// Create a cacheable request/response, but it should not be cached.
93103
$cacheReq = new Google_Http_Request($url, "GET");
94-
$cacheReq->setRequestHeaders(array(
95-
"Accept" => "*/*",
96-
"Authorization" => "Bearer Foo"
97-
));
104+
$cacheReq->setRequestHeaders(
105+
array(
106+
"Accept" => "*/*",
107+
"Authorization" => "Bearer Foo"
108+
)
109+
);
98110
$cacheReq->setResponseBody("{\"a\": \"foo\"}");
99111
$cacheReq->setResponseHttpCode(200);
100-
$cacheReq->setResponseHeaders(array(
101-
"Cache-Control" => "private",
102-
"ETag" => "\"this-is-an-etag\"",
103-
"Expires" => "Sun, 22 Jan 2022 09:00:56 GMT",
104-
"Date: Sun, 1 Jan 2012 09:00:56 GMT",
105-
"Content-Type" => "application/json; charset=UTF-8",
106-
));
112+
$cacheReq->setResponseHeaders(
113+
array(
114+
"Cache-Control" => "private",
115+
"ETag" => "\"this-is-an-etag\"",
116+
"Expires" => "Sun, 22 Jan 2022 09:00:56 GMT",
117+
"Date: Sun, 1 Jan 2012 09:00:56 GMT",
118+
"Content-Type" => "application/json; charset=UTF-8",
119+
)
120+
);
107121

108122
$result = $io->setCachedRequest($cacheReq);
109123
$this->assertFalse($result);
110124
}
111-
112-
public function responseChecker($io) {
125+
126+
public function responseChecker($io)
127+
{
113128
$rawHeaders = "HTTP/1.1 200 OK\r\n"
114129
. "Expires: Sun, 22 Jan 2012 09:00:56 GMT\r\n"
115130
. "Date: Sun, 22 Jan 2012 09:00:56 GMT\r\n"
@@ -140,7 +155,8 @@ public function responseChecker($io) {
140155
$this->assertEquals(array(), json_decode($body, true));
141156
}
142157

143-
public function processEntityRequest($io, $client) {
158+
public function processEntityRequest($io, $client)
159+
{
144160
$req = new Google_Http_Request("http://localhost.com");
145161
$req->setRequestMethod("POST");
146162

@@ -163,17 +179,21 @@ public function processEntityRequest($io, $client) {
163179
$req->setPostBody(array("a" => "1", "b" => 2));
164180
$io->processEntityRequest($req);
165181
$this->assertEquals(7, $req->getRequestHeader("content-length"));
166-
$this->assertEquals(Google_IO_Abstract::FORM_URLENCODED,
167-
$req->getRequestHeader("content-type"));
182+
$this->assertEquals(
183+
Google_IO_Abstract::FORM_URLENCODED,
184+
$req->getRequestHeader("content-type")
185+
);
168186
$this->assertEquals("a=1&b=2", $req->getPostBody());
169187

170188
// Verify that the content-type isn't reset.
171189
$payload = array("a" => "1", "b" => 2);
172190
$req->setPostBody($payload);
173191
$req->setRequestHeaders(array("content-type" => "multipart/form-data"));
174192
$io->processEntityRequest($req);
175-
$this->assertEquals("multipart/form-data",
176-
$req->getRequestHeader("content-type"));
193+
$this->assertEquals(
194+
"multipart/form-data",
195+
$req->getRequestHeader("content-type")
196+
);
177197
$this->assertEquals($payload, $req->getPostBody());
178198
}
179199
}

tests/youtube/YouTubeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testMissingFieldsAreNull()
7171
$o_channel = new Google_Service_YouTube_Channel();
7272
$o_channel->setContentOwnerDetails($owner_details);
7373
$simpleManual = $o_channel->toSimpleObject();
74-
74+
7575
$this->assertObjectHasAttribute('timeLinked', $simpleManual->contentOwnerDetails);
7676
$this->assertObjectNotHasAttribute('contentOwner', $simpleManual->contentOwnerDetails);
7777

@@ -80,7 +80,7 @@ public function testMissingFieldsAreNull()
8080
$o_channel = new Google_Service_YouTube_Channel();
8181
$o_channel->setContentOwnerDetails($owner_details);
8282
$simpleManual = $o_channel->toSimpleObject();
83-
83+
8484
$this->assertObjectHasAttribute('timeLinked', $simpleManual->contentOwnerDetails);
8585
$this->assertObjectNotHasAttribute('contentOwner', $simpleManual->contentOwnerDetails);
8686

0 commit comments

Comments
 (0)