ShopwareCli\Services\OpenSSLVerifier::isSystemSupported PHP Method

isSystemSupported() public method

public isSystemSupported ( ) : boolean
return boolean
    public function isSystemSupported()
    {
        return function_exists('openssl_verify');
    }

Usage Example

 /**
  * Loads a list of the latest releases from the update API
  * Returns them indexed by the Shopware version (e.g: 5.1.0)
  *
  * @return array
  */
 private function getIndexedReleasesList()
 {
     $client = new Client();
     $response = $client->get(self::DOWNLOAD_UPDATE_API);
     $signature = $response->getHeader('X-Shopware-Signature');
     if ($this->openSSLVerifier->isSystemSupported()) {
         if (!$this->openSSLVerifier->isValid($response->getBody(), $signature)) {
             throw new \RuntimeException('API signature verification failed');
         }
     }
     $releases = $response->json();
     if (empty($releases)) {
         throw new \RuntimeException("Could not get releases list package");
     }
     $indexedReleases = [];
     foreach ($releases as $release) {
         $indexedReleases[$release['version']] = $release;
     }
     return $indexedReleases;
 }