1616 */
1717class CloudFunctions {
1818
19- private static stdClass $ response ;
20-
21- /** */
19+ /** On HTTPS */
2220 public static function on_https ( ServerRequestInterface $ request ): ResponseInterface {
2321 $ params = $ request ->getQueryParams ();
2422 $ body = sprintf ('Hello, %s! ' , $ params ['name ' ] ?? 'World ' );
@@ -27,7 +25,7 @@ public static function on_https( ServerRequestInterface $request ): ResponseInte
2725 ->withStatus (200 );
2826 }
2927
30- /** */
28+ /** On Pub/Sub Event */
3129 public static function on_pubsub ( CloudEventInterface $ event ): void {
3230 $ log = fopen (getenv ('LOGGER_OUTPUT ' ) ?: 'php://stdout ' , 'wb ' );
3331 $ cloudEventData = $ event ->getData ();
@@ -36,15 +34,15 @@ public static function on_pubsub( CloudEventInterface $event ): void {
3634 fwrite ($ log , "Hello, $ name! " . PHP_EOL );
3735 }
3836
39- /** */
37+ /** On GCS Event */
4038 public static function on_gcs ( CloudEventInterface $ event ): void {
4139 $ log = fopen (getenv ('LOGGER_OUTPUT ' ) ?: 'php://stdout ' , 'wb ' );
4240 $ data = $ event ->getData ();
43- fwrite ($ log , 'Event: ' . $ event ->getId () . PHP_EOL );
41+ fwrite ($ log , 'Event: ' . $ event ->getId () . PHP_EOL );
4442 fwrite ($ log , 'Event Type: ' . $ event ->getType () . PHP_EOL );
45- fwrite ($ log , 'Bucket: ' . $ data ['bucket ' ] . PHP_EOL );
46- fwrite ($ log , 'File: ' . $ data ['name ' ] . PHP_EOL );
47- fwrite ($ log , 'Metageneration : ' . $ data ['metageneration ' ] . PHP_EOL );
43+ fwrite ($ log , 'Bucket: ' . $ data ['bucket ' ] . PHP_EOL );
44+ fwrite ($ log , 'File: ' . $ data ['name ' ] . PHP_EOL );
45+ fwrite ($ log , 'Metagen : ' . $ data ['metageneration ' ] . PHP_EOL );
4846 fwrite ($ log , 'Created: ' . $ data ['timeCreated ' ] . PHP_EOL );
4947 fwrite ($ log , 'Updated: ' . $ data ['updated ' ] . PHP_EOL );
5048 }
0 commit comments