Skip to content

Commit c00f816

Browse files
author
ace-n
committed
Address comments
1 parent cd1d4f0 commit c00f816

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

functions/slack_slash_command/index.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
function isValidSlackWebhook(ServerRequestInterface $request): bool
3333
{
3434
/**
35-
* PHP Functions Framework does not support "global"/instance-scoped
36-
* constants, so we fetch these values within PHP functtions themselves.
35+
* Unlike most other Cloud Functions languages, PHP does not preserve
36+
* global values between requests. Since we don't use this value elsewhere
37+
* in the sample, it's easiest to declare it within this method itself.
3738
*/
3839
$SLACK_SECRET = getenv('SLACK_SECRET');
3940

@@ -111,8 +112,9 @@ function formatSlackMessage($kgResponse, $query): string
111112
function searchKnowledgeGraph($query): Google_Service_Kgsearch_SearchResponse
112113
{
113114
/**
114-
* PHP Functions Framework does not support "global"/instance-scoped
115-
* constants, so we fetch these values within PHP functions themselves.
115+
* Unlike most other Cloud Functions languages, PHP does not preserve
116+
* global values between requests. Since we don't use this value elsewhere
117+
* in the sample, it's easiest to declare it within this method itself.
116118
*/
117119
$API_KEY = getenv("KG_API_KEY");
118120

functions/slack_slash_command/test/SystemTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ public function testFunction(
5151
['headers' => $headers, 'body' => $body]
5252
);
5353
$this->assertEquals(
54-
$statusCode, $response->getStatusCode(), $label . ": status code");
54+
$statusCode,
55+
$response->getStatusCode(),
56+
$label . ": status code"
57+
);
5558

5659
if ($expected !== null) {
5760
$output = (string) $response->getBody();

0 commit comments

Comments
 (0)