original_string: protected function getSafebrowsingResult(string $url)
      {
          // Prepare the Safebrowsing API URL and
          // populate the API key for the request
          $safebrowsingUrl = sprintf('https://safebrowsing.googleapis.com/v4/threatMatches:find?key=%s', $this->apiKey);
  
          // Prepare the payload that will be sent
          // to Google Safebrowsing API as JSON
          $safebrowsingPayload = [
              'client' => [
                  'clientId' => 'Ampersa/SafeBrowsing',
                  'clientVersion' => '0.1',
              ],
              'threatInfo' => [
                  'threatTypes' => [
                      'MALWARE',
                      'SOCIAL_ENGINEERING',
                      'UNWANTED_SOFTWARE',
                      'POTENTIALLY_HARMFUL_APPLICATION',
                  ],
                  'platformTypes' => [
                      'ANY_PLATFORM'
                  ],
                  'threatEntryTypes' => [
                      'URL',
                  ],
                  'threatEntries' => [
                      [
                          'url' => $url
                      ],
                  ],
              ]
          ];
  
          // Prepare the request and get the response
          try {
              $response = (new HttpClient)->post($safebrowsingUrl, [
                  'json' => $safebrowsingPayload
              ]);
          } catch (Exception $e) {
              return new StdClass;
          }
  
          // Retrieve and decode the result from the response
          $result = json_decode((string) $response->getBody());
  
          return $result;
      }
code: protected function getSafebrowsingResult(string $url)
      {
          // Prepare the Safebrowsing API URL and
          // populate the API key for the request
          $safebrowsingUrl = sprintf('https://safebrowsing.googleapis.com/v4/threatMatches:find?key=%s', $this->apiKey);
  
          // Prepare the payload that will be sent
          // to Google Safebrowsing API as JSON
          $safebrowsingPayload = [
              'client' => [
                  'clientId' => 'Ampersa/SafeBrowsing',
                  'clientVersion' => '0.1',
              ],
              'threatInfo' => [
                  'threatTypes' => [
                      'MALWARE',
                      'SOCIAL_ENGINEERING',
                      'UNWANTED_SOFTWARE',
                      'POTENTIALLY_HARMFUL_APPLICATION',
                  ],
                  'platformTypes' => [
                      'ANY_PLATFORM'
                  ],
                  'threatEntryTypes' => [
                      'URL',
                  ],
                  'threatEntries' => [
                      [
                          'url' => $url
                      ],
                  ],
              ]
          ];
  
          // Prepare the request and get the response
          try {
              $response = (new HttpClient)->post($safebrowsingUrl, [
                  'json' => $safebrowsingPayload
              ]);
          } catch (Exception $e) {
              return new StdClass;
          }
  
          // Retrieve and decode the result from the response
          $result = json_decode((string) $response->getBody());
  
          return $result;
      }
code_tokens: protected function getSafebrowsingResult ( string $ url ) { // Prepare the Safebrowsing API URL and // populate the API key for the request $ safebrowsingUrl = sprintf ( 'https://safebrowsing.googleapis.com/v4/threatMatches:find?key=%s' , $ this -> apiKey ) ; // Prepare the payload that will be sent // to Google Safebrowsing API as JSON $ safebrowsingPayload = [ 'client' => [ 'clientId' => 'Ampersa/SafeBrowsing' , 'clientVersion' => '0.1' , ] , 'threatInfo' => [ 'threatTypes' => [ 'MALWARE' , 'SOCIAL_ENGINEERING' , 'UNWANTED_SOFTWARE' , 'POTENTIALLY_HARMFUL_APPLICATION' , ] , 'platformTypes' => [ 'ANY_PLATFORM' ] , 'threatEntryTypes' => [ 'URL' , ] , 'threatEntries' => [ [ 'url' => $ url ] , ] , ] ] ; // Prepare the request and get the response try { $ response = ( new HttpClient ) -> post ( $ safebrowsingUrl , [ 'json' => $ safebrowsingPayload ] ) ; } catch ( Exception $ e ) { return new StdClass ; } // Retrieve and decode the result from the response $ result = json_decode ( ( string ) $ response -> getBody ( ) ) ; return $ result ; }
docstring: Prepare the request to Google Safebrowsing, retrieve the result
  and decode before returning.
  @param  string $url
  @return object
docstring_tokens: Prepare the request to Google Safebrowsing retrieve the result and decode before returning .