code: public function cache(ContentfulAsset $asset)
      {
          if (!isset($asset->file)) {
              $this->log('Asset %s has no file.', $asset);
              return;
          }
          foreach ($asset->file as $locale => $file) {
              if (!$file) {
                  // File not published.
                  $this->log('Asset %s contains unpublished file for %s.', $asset, $locale);
                  continue;
              }
              $localFile = $this->getLocalFile($asset, $locale);
              if ($localFile->isFile()) {
                  continue;
              }
              $this->log(
                  'Caching "%s" file for asset "%s" as "%s" ...',
                  $locale,
                  $asset->getId(),
                  $localFile->getPathname()
              );
              $dir = new \SplFileInfo($localFile->getPath());
              if (!$dir->isWritable()) {
                  throw new RuntimeException(
                      sprintf(
                          'Target directory "%s" is not writeable!',
                          $localFile->getPath()
                      )
                  );
              }
              copy(str_replace('//', 'https://', $file['url']), $localFile->getPathname());
              $size = filesize($localFile->getPathname());
              $this->log(
                  '%d bytes saved.',
                  $size
              );
          }
      }
docs: Caches the asset to the local filesystem.
  
  @param ContentfulAsset $asset
  
  @return void
  @throws RuntimeException