original_string: public function requestPopularProducts($type = null)
      {
          if ($type != 'plugin' && $type != 'theme') {
              $type = 'plugin';
          }
  
          $cacheKey = 'system-updates-popular-'.$type;
  
          if (Cache::has($cacheKey)) {
              return @unserialize(@base64_decode(Cache::get($cacheKey))) ?: [];
          }
  
          $data = $this->requestServerData($type.'/popular');
          Cache::put($cacheKey, base64_encode(serialize($data)), 60);
  
          foreach ($data as $product) {
              $code = array_get($product, 'code', -1);
              $this->cacheProductDetail($type, $code, $product);
          }
  
          $this->saveProductDetailCache();
  
          return $data;
      }
code: public function requestPopularProducts($type = null)
      {
          if ($type != 'plugin' && $type != 'theme') {
              $type = 'plugin';
          }
  
          $cacheKey = 'system-updates-popular-'.$type;
  
          if (Cache::has($cacheKey)) {
              return @unserialize(@base64_decode(Cache::get($cacheKey))) ?: [];
          }
  
          $data = $this->requestServerData($type.'/popular');
          Cache::put($cacheKey, base64_encode(serialize($data)), 60);
  
          foreach ($data as $product) {
              $code = array_get($product, 'code', -1);
              $this->cacheProductDetail($type, $code, $product);
          }
  
          $this->saveProductDetailCache();
  
          return $data;
      }
code_tokens: public function requestPopularProducts ( $ type = null ) { if ( $ type != 'plugin' && $ type != 'theme' ) { $ type = 'plugin' ; } $ cacheKey = 'system-updates-popular-' . $ type ; if ( Cache :: has ( $ cacheKey ) ) { return @ unserialize ( @ base64_decode ( Cache :: get ( $ cacheKey ) ) ) ? : [ ] ; } $ data = $ this -> requestServerData ( $ type . '/popular' ) ; Cache :: put ( $ cacheKey , base64_encode ( serialize ( $ data ) ) , 60 ) ; foreach ( $ data as $ product ) { $ code = array_get ( $ product , 'code' , - 1 ) ; $ this -> cacheProductDetail ( $ type , $ code , $ product ) ; } $ this -> saveProductDetailCache ( ) ; return $ data ; }
docstring: Returns popular themes found on the marketplace.
docstring_tokens: Returns popular themes found on the marketplace .